Nginx TP5环境配置

 Apache默认支持Pathinfo模式  Nginx不支持  需要手动配置

复制代码
 Apache默认支持Pathinfo模式  Nginx不支持  需要手动配置

server {
    #配置监听端口
    listen 80;
    listen [::]:80;
    #设置网站根目录作为变量root
    set $root /var/www/web;
    #设置网站根目录
    root $root; 
    #设置访问日志存放路径
    #access_log logs/access.log;
    #设置错误日志存放路径
    #error_log  logs/error.log;
    #设置网站默认首页
    index index.html index.php;
    #设置域名       
    server_name example.ilxqx.com;
    #设置字符集
    charset utf-8;

    #此配置用于静态文件配置
    #location /static {
        #try_files $uri $uri/ =404;
    #}

    #配置PHP的重写规则
    location / {
        #开启目录浏览功能
        #autoindex on;
        #关闭详细文件大小统计,让文件大小显示MB,GB单位,默认为b
        #autoindex_exact_size on;
        #开启以服务器本地时区显示文件修改日期
        #autoindex_localtime on;
        if ( !-e $request_filename) {
            rewrite ^/(.*)$ /index.php/$1 last;
            break;
        } 
    }

    #配置PHP的pathinfo
    location ~ .+\.php($|/) {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_split_path_info ^((?U).+.php)(/?.+)$;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
        fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
        include fastcgi_params;
        include snippets/fastcgi-php.conf;
    }
}
复制代码

 


原文链接:https://blog.csdn.net/weixin_40575384/java/article/details/90696029

posted @   study_php_java_C++  阅读(406)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· DeepSeek 开源周回顾「GitHub 热点速览」
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示