server{
listen 80 ;
server_name xxxx.cn ;
root /www/admin/xxxx.cn_80/wwwroot/public/ ;
#301重定向
#rewrite ^(.*)$ $1 permanent;
#强制SSL
#rewrite ^(.*)$ https://$host$1 permanent;
#防盗链
location / {
#伪静态
#首页
root /www/admin/xxxx.cn_80/wwwroot/public/;
index index.php index.html error/index.html;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
#流量限制
#日志
access_log /www/admin/xxxx.cn_80/log/nginx_access_$logdate.log main;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
#处理PHP
location ~ \.php(.*)$ {
root /www/admin/xxxx.cn_80/wwwroot/public/;
fastcgi_pass 127.0.0.1:7131;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
}
nginx配置
最新推荐文章于 2024-12-11 11:19:47 发布