nginx Server服务配置说明
配置Demo
server {
server_name adminapi-local.activity.com;
root D:\WWW\project\activity-api\public;
index index.php index.html;
access_log /data/log/nginx/lottery-$host.log;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /admin.php?pathinfo=$1 last;
break;
}
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
fastcgi_param LOTTERY_ENV dev;
}
}
路由到项目根目录时的处理
location / {
}
请求网站下PHP文件的时候,反向代理到cgi
location ~ .php(.*)$ {
}
https://blog.csdn.net/zjuwangleicn/article/details/79300347
当访问的文件和目录不存在时,重定向到某个php文件
if( !-e $request_filename )
{
rewrite ^/(.*)$ index.php last;
}
https://www.linuxidc.com/Linux/2014-01/95493.htm
服务配置指令
listen 80 监听端口
server_name www.test.com 主机host
root /data/html 根目录
index index.php index.html 首页
location / {} 根目录路由