Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If anyone finds this page by encountering the same problem I had, I found the answer here: <a href="http://www.howtoforge.com/installing-nginx-with-php5-and-php-fpm-and-mysql-support-lemp-on-ubuntu-12.04-lts" rel="nofollow noreferrer">http://www.howtoforge.com/installing-nginx-with-php5-and-php-fpm-and-mysql-support-lemp-on-ubuntu-12.04-lts</a></p> <p>For those of you who can't be bothered to click and work it out for themselves... ;)</p> <p><strong>The Condition:</strong></p> <p>Ubuntu or Debian server with NGINX and PHP 5.3 works fine but upgrading PHP to 5.4 gives 502 Bad Gateway errors. Looking for services running on port 9000 (typically running <code>netstat -lp</code> or similar) returns nothing.</p> <p><strong>The fix:</strong></p> <p>Open <code>/etc/php5/fpm/pool.d/www.conf</code> and make a note of the 'listen' parameter (in my case <code>/var/run/php5-fpm.sock</code>):</p> <pre><code>; The address on which to accept FastCGI requests. ; Valid syntaxes are: ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on ; a specific port; ; 'port' - to listen on a TCP socket to all addresses on a ; specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. listen = /var/run/php5-fpm.sock </code></pre> <p>and replace the fastcgi_pass variable in your vhost with the location you just noted.</p> <p>So this sample symfony2 configuration (taken from here: <a href="http://wiki.nginx.org/Symfony" rel="nofollow noreferrer">http://wiki.nginx.org/Symfony</a>):</p> <pre><code> # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 location ~ ^/(app|app_dev)\.php(/|$) { fastcgi_pass 127.0.0.1:9000; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; } </code></pre> <p>becomes this:</p> <pre><code> # pass the PHP scripts to FastCGI server at /var/run/php5-fpm.sock location ~ ^/(app|app_dev)\.php(/|$) { fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_split_path_info ^(.+\.php)(/.*)$; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param HTTPS off; } </code></pre> <p>Then restart nginx:</p> <pre><code>sudo /etc/init.d/nginx restart </code></pre> <p><strong>Note:</strong> replace <code>~ ^/(app|app_dev)\.php(/|$) {</code> with <code>~ ^/index\.php(/|$) {</code> if you're not on SF2**</p> <p>Hope this saves someone a little bit of time :)</p> <p><strong>Edit</strong></p> <p>Of course, you could change the <code>listen = /var/run/php5-fpm.sock</code> to <code>listen = 127.0.0.1:9000</code> in <code>/etc/php5/fpm/pool.d/www.conf</code> then restart php5-fpm (which would save you from having to change your vhosts), but you have to assume they changed php5-fpm to run through a socket rather than listening on port 9000 for a reason.</p> <p><strong>Edit2</strong></p> <p>If you're still experiencing 502 error see this answer: <a href="https://stackoverflow.com/questions/23443398/nginx-error-connect-to-php5-fpm-sock-failed-13-permission-denied/23487409#23487409">nginx error connect to php5-fpm.sock failed (13: Permission denied)</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload