网上找的一个nginx站点标准配置模版
server {
listen 80;
server_name foo.com;
root /path;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ /.php$ {
try_files $uri =404;
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}
我的ubuntu虚拟机内的站点配置模版
server {
listen 80;
root /home/justfantasy/web/isee/public;
index index.php index.html index.htm;
server_name isee.local;
location / {
try_files $uri $uri/ /index.php$is_args$args; //此处之前未加$is_args导致没有获取到get参数
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /home/justfantasy/web/isee/pulic;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}