1. 安装nginx : sudo apt-get install nginx
2. 写conf : /etc/nginx/conf.d 或者 /etc/nginx/sites-avaliable
server { listen 80; root /home/susie/workspace/ec/src/www-web; index index.html index.htm index.php; server_name ec.cn; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ .php$ { try_files $uri =404; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php5-fpm.sock; include fastcgi_params; } }
3. host部署 : /etc sudo vi hosts
127.0.0.1 ec.cn
4. 重启nginx : sudo service nginx restart