Nginx with Apache + FastCGI + PHP-FPM
Install Apache2 + FastCGI + PHP-FPM
Apache Settings
/etc/apache2/sites-availabe/test.server.com.conf:
1 2 3 4 5 6 7 |
<VirtualHost 127.0.0.1:8080> ServerName test.server.com ServerAdmin webmaster@server.com DocumentRoot /var/www/test.server.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> |
/etc/apache2/ports.conf:
1 |
Listen 127.0.0.1:8080 |
Install Nginx
sudo apt-get install nginx
/etc/nginx/sites-available/test:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
server { listen 80; root /var/www/test.server.com; index index.html index.php index.htm; server_name test.server.com; location / { # Custom 404 page # try_files $uri $uri/ /not_found_error.html; } location ~ \.php$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8080; } location ~ /\.ht { deny all; } } |
sudo ln -s /etc/nginx/sites-available/test /etc/nginx/sites-enabled/test
sudo rm /etc/nginx/sites-enabled/default
Restart Server
sudo service nginx restart
sudo service apache2 restart
sudo service php5-fpm restart