tp5 nginx 路由問題


一、修改nginx 配置文件

server {
listen 888;
server_name www.域名.com;
index index.html index.htm index.php;
root /www/wwwroot/文件根目錄;

#error_page 404 = /404.html;
#error_page 502 = /502.html;

if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}

location ~ [^/]\.php(/|$) {

fastcgi_split_path_info ^(.+\.php)(/.+)$;
try_files $fastcgi_script_name =404;
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;

include fastcgi.conf;

}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /\.ht {
deny all;
}
}

  二、偽靜態

 

location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM