title: Ajax post works on localhost, but not on nginx server
body: <p>I was experimenting with building a small CMS for a project. Part of it was, that when you click on the <code>save-button</code> your current edits will be saved. </p>
  
  <pre class="lang-js prettyprint-override"><code>$('.save-button').click(function() {
  
    var speisekarte_content = $(".speisekarte-content").html();
    console.log(speisekarte_content);
    var ajaxurl = 'save.php',
      data = {
        'content': speisekarte_content
      };
    $.post(ajaxurl, data, function(response) {
      alert("action performed successfully");
    });
  
  });
  </code></pre>
  
  
  
  <p>The save.php looks like this:</p>
  
  <pre class="lang-php prettyprint-override"><code>&lt;?php
  
  $post_data = $_POST['content'];
  
  if (function_exists('fopen')) { 
      if (!empty($post_data)) {
          $filename = 'speisekarte-content.php';
          $handle = fopen($filename, "w");
          fwrite($handle, $post_data);
          fclose($handle);
          echo $file;
      }
  };
  
  ?&gt;
  </code></pre>
  
  
  
  <p>So it basically just adds the content that should be saved to a file called <code>speisekarte-content.php</code> … This worked perfectly on localhost – until I uploaded it to my nginx server and it stopped working as supposed. 
  This is the error log that I found in the javascript console: </p>
  
  
  
  <pre><code>POST
  http://www.myurl.com/editable/save.php net::ERR_TIMED_OUT
  
  k.cors.a.crossDomain.send @ jquery.min.js:4
  n.extend.ajax @ jquery.min.js:4
  n.(anonymous function) @ jquery.min.js:4
  (anonymous function) @ main.js:99
  </code></pre>
  
  <p>The nginx error logs are the following</p>
  
  <pre><code>2015/06/22 08:43:45 [error] 6804#0: *63817 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined index: content in /var/www/myurl.com/html/editable/save.php on line 2
  PHP message: PHP Warning:  fopen(autosave.php): failed to open stream: Permission denied in /var/www/myurl.com/html/editable/save.php on line 27
  PHP message: PHP Warning:  fwrite() expects parameter 1 to be resource, boolean given in /var/www/myurl.com/html/editable/save.php on line 28
  PHP message: PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /var/www/myurl.com/html/editable/save.php on line 29
  PHP message: PHP Notice:  Undefined variable: file in /var/www/myurl.com/html/editable/save.php on line 30" while reading response header from upstream, client: 176.0.1.54, server: myurl.com, request: "POST /editable/save.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.myurl.com", referrer: "http://www.myurl.com/editable/"
  </code></pre>
  
  <p>Is this related to nginx or my code?</p>