How to use nginx with php?

What is a good way to use PHP with nginx? From what I got, maybe using PHP-FPM might be a good way to pass PHP over nginx.

The problem is that the free web interface that we serve receives a lot of requests (about 500 thousand per day), the requests are mostly very short and small in size, but Apache consumes a lot of memory. I want to try nginx to see if it can handle it better.

Thanks.

+7
php nginx
source share
1 answer
  • Ubuntu Lucid 64-bit
  • apt-get install nginx
  • apt-get update
  • apt-get install php5-cli php5-common php5-suhosin
  • apt-get install python-software-properties
  • add-apt-repository ppa: brianmercer / php
  • apt-get update && & & & apt-get install php5-fpm php5-cgi
  • /etc/init.d/nginx restart
  • /etc/init.d/php5-fpm restart

Edit (this may be required on your conf site):

location ~ \.php$ { fastcgi_read_timeout 60000; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/site$fastcgi_script_name; include fastcgi_params; } location ~ /\.ht { deny all; } 
+11
source share

All Articles