• nginx 配置虚拟机 支持pathinfo


    server {
            server_name shopx.local *.shopx.local;
            charset utf-8;
            root /Users/x/www/php/shopx.local/shopx/public;
            #让浏览器缓存静态文件
            location ~ .*.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|js|css)$
            {
                expires      30d;
            }
            location / {
                index  index.html index.htm index.php;
                 if (!-e $request_filename) {
                    rewrite ^/(.*)$ /index.php/$1;
                }
            }
            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 ~ /.ht {
                deny  all;
            }
    }
    

    宝塔nginx项目配置

    server
    {
        listen 80;
        server_name thankdom.com www.ydshopv1.thankdom.com admin.ydshopv1.thankdom.com api.ydshopv1.thankdom.com m.ydshopv1.thankdom.com shop.ydshopv1.thankdom.com;
        index index.php index.html index.htm default.php default.htm default.html;
        root /www/wwwroot/ydshopv1/public;
        
        #SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
        #error_page 404/404.html;
        #SSL-END
        
        #ERROR-PAGE-START  错误页配置,可以注释、删除或修改
        error_page 404 /404.html;
        error_page 502 /502.html;
        #ERROR-PAGE-END
        
        #PHP-INFO-START  PHP引用配置,可以注释或修改
        include enable-php-72.conf;
        #PHP-INFO-END
        
        #REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
        include /www/server/panel/vhost/rewrite/thankdom.com.conf;
        #REWRITE-END
        
        #禁止访问的文件或目录
        location ~ ^/(.user.ini|.htaccess|.git|.svn|.project|LICENSE|README.md)
        {
            return 404;
        }
        
        location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
            access_log off; 
        }
        
        location ~ .*.(js|css)?$
        {
            expires      12h;
            access_log off; 
        }
        access_log  /www/wwwlogs/thankdom.com.log;
        error_log  /www/wwwlogs/thankdom.com.error.log;
    }
    

    nginx伪静态

    location / {
         if (!-e $request_filename) {
              rewrite ^/(.*)$ /index.php/$1;
         }
    }
    
  • 相关阅读:
    一道初中练习题,现在的我几乎差点很有可能搞不好似乎仿佛就没有做出来.
    [转]IBM ThinkPad 全新、原装机验机流程(完全版)
    在一个BBS上看到的.觉得很不错,放过来.
    验证数字的正则表达式集
    基于百度地图SDK + SQLite数据库的安卓管理系统
    C# 将系统时间转换成农历时间
    博客园
    C#正则表达式的简单用法
    单张图片轮换
    2个有焦点时文字消失或变淡效果
  • 原文地址:https://www.cnblogs.com/xielisen/p/8562850.html
Copyright © 2020-2023  润新知