# sudo /etc/init.d/apache2 stop
# sudo: /etc/init.d/apache2: command not found
# sudo update-rc.d -f apache2 remove
# sudo apt-get purge apache2
# sudo apt-get update
# sudo apt-get install nginx
# sudo service nginx
# Usage: nginx {start|stop|restart|reload|force-reload|status|configtest|rotate|upgrade}
# sudo service nginx configtest
# sudo service nginx start
# Welcome to nginx on Debian!
# sudo service nginx stop
# sudo mkdir /home/server
# sudo mkdir /home/server/www
# sudo nano /home/serveur/www/index.html
<html><body>My test page</body></html>
# sudo nano /etc/nginx/sites-available/default
# sudo nano /etc/nginx/sites-available/site1
# server {
listen 80;
root /home/server/www;
index index.html index.htm;
server_name localhost;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
}
# cd /etc/nginx/sites-enabled
# sudo ln -s ../sites-available/site1
# sudo rm default
# sudo service nginx restart
# My test page
# Welcome to nginx on Debian!
# cd /var/www/html/
# sudo mv index.nginx-debian.html index.nginx-debian.html.origin
# sudo service nginx restart
# My test page
# sudo apt-get install php5-fpm
# sudo nano /etc/php5/fpm/pool.d/www.conf
# ;listen = 127.0.0.1:9000
listen = /var/run/php5-fpm.sock
# sudo service php5-fpm restart
# sudo nano /etc/nginx/conf.d/php5-fpm.conf
# upstream php5-fpm-sock {
server unix:/var/run/php5-fpm.sock;
}
# sudo service nginx restart
# sudo nano /usr/share/nginx/html/index.php
# <?php phpinfo(); ?>
# sudo nano /etc/nginx/sites-available/site1
server {
listen 80 default_server;
root /home/serveur/www;
index index.php index.html;
server_name 193.70.5.42;
access_log /var/log/nginx/default-access_log;
error_log /var/log/nginx/default-error_log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_pass php5-fpm-sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
# sudo service nginx restart
# ls -l /etc/nginx/sites-enabled/
# site1 -> ../sites-available/site1
# sudo service nginx restart