注意index,try_files指令的用法
server {
listen 8803 default_server;server_name test.php.360.cn;
root /data/www/test;
index index.html index.htm index.php;
location / {
try_files $uri $uri/ /index.php; #try_files 会自动去掉末尾的斜杠
}
location ~ \.php$ {
try_files $uri =404; #优化文件不存在的话提前报错, fascgi 404 File not found.
include fastcgi.conf;
fastcgi_pass 127.0.0.1:9000;
}
}
server {
listen 80;
server_name yaf.com;
root /home/acmer1183/yaf/public;
index index.php index.html;
access_log /data/nginx/logs/yaf.com.access.log;
error_log /data/nginx/logs/yaf.com.error.log;
rewrite