Ubuntu+Nginx+PHP的最简搭建方法
先安装:
sudo apt-get install nginx php5-fpm -y
然后编辑配置文件:
/etc/nginx/site-available/default
找到“location ~ \.php$”的地方,5行取消注释,变成这样:
location ~ \.php$ {
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
## NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
#
## With php5-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
## With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
启动nginx:
sudo service nginx start