Friday, December 9, 2011

Nginx PHP-FastCGI https 502 error/white pages

SkyHi @ Friday, December 09, 2011
Server { 
      listen 1.1.1.1:443 ssl; 
      server_name website www.website; 
      access_log logs/website.access.log main; 
      error_log logs/website.error.log error; 
      keepalive_timeout 70; 

      root /srv/http/website/public_html; 
      index index.php index.html index.htm; 

      location /gallery/ { 
         auth_basic "Restricted"; 
         auth_basic_user_file /srv/http/website/htpasswd; 
      } 

      ssl_certificate /etc/ssl/private/website.pem; 
      ssl_certificate_key /etc/ssl/private/website.key; 
      ssl_session_timeout 5m; 
      ssl_protocols SSLv2 SSLv3 TLSv1; 
      ssl_ciphers HIGH:!aNULL:!MD5; 
      ssl_prefer_server_ciphers on; 

      location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ { 
         access_log off; 
         expires max; 
      } 

      location ~ \.php$ { 
         include fastcgi.conf; 
         fastcgi_index index.php;
         ###Using http://library.linode.com/lemp-guides Howto###
         #fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; 
         fastcgi_pass 127.0.0.1:9000; 
         ##fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name
         fastcgi_param HTTPS on; 
      } 
   }

REFERENCES
http://forum.linode.com/viewtopic.php?t=7666