欢迎访问!

Office学习网

您现在的位置是:主页 > 站长知识

站长知识

nginx伪静态规则配置

发布时间:2026-06-19站长知识评论
Nginx配置文件示例包含监听80端口、设置根目录及PHP处理规则,建议将伪静态规则单独写入rewrite.conf文件并通过includ

这样可以在rewrite.conf里面写n多配置 代码语言: javascript 复制 location / {            index  index.php index.htm /public/index.html;            autoindex  off;            include rewrite.conf;            #rewrite a.html /index.php/front/index/index last;        } rewrite.conf (这个文件自己创建就行了。

文件内容写规则) 代码语言: javascript 复制 #场景一的规则    # a.html /index.php/front/index/index last;#场景二的规则    #1.    #2.?name=yangxignyiage=18    #3. parse-(w+)-(d+).html /index.php/front/index/parse/name/$1/age/$2 last; 最后。

a, 。

include 进来就行了,不推荐这样做,span{ text-indent:0px !important; word-break: break-all; } 未经允许不得转载:肥猫博客 » nginx伪静态规则配置 本文参与 腾讯云自媒体同步曝光计划,请联系 cloudcommunity@tencent.com 删除, 服务器配置文件: ​ 代码语言: javascript 复制 server{        listen       80;        server_name  ;        root   D:/phpStudy/WWW/abc;        location / {            index  index.php index.htm /public/index.html;            autoindex  off;            include abc.conf;            #rewrite a.html /index.php/front/index/index last;        }        location ~ .php(.*)$  {            fastcgi_pass   127.0.0.1:9000;            fastcgi_index  index.php;            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;        }    } 伪静态配置文件可以直接写在 location / {} 里面的, 如有侵权请联系 cloudcommunity@tencent.com 删除 前往查看 nginx 本文分享自 作者个人站点/博客   前往查看 如有侵权,重启nginx! .pwarm{ text-indent:0px !important; padding: 5px !important; } .pwarm p,分享自作者个人站点/博客,建议新增加个rewrite.conf写伪静态文件会好点,。

广告位

热心评论

评论列表