zoukankan      html  css  js  c++  java
  • nginx配置tp5的pathinfo模式并隐藏后台入口文件

    server {
        listen 2223;
        server_name manage;
        access_log /data/wwwlogs/access_manage.log combined;
        root /data/wwwroot/webroot/manage/public;
        index index.html index.htm admin.php;#默认后台admin.php
    
        location / {
            if (!-e $request_filename) {
                rewrite ^(.*)$ /admin.php$1 last; #隐藏后台入口文件admin.php
                break;
            }
        }
    
        location ~ ^(.+.php)(.*)$ {
            # try_files $uri =404;
            fastcgi_pass unix:/dev/shm/php-cgi.sock; #注意:不同系统,路由不一样
            fastcgi_index index.php;
    
            include fastcgi_params;
            fastcgi_split_path_info ^(.+.php)(/?.*)$;
            fastcgi_param PATH_INFO $fastcgi_path_info;
    
            # 强制将某些非法地址交给 index.php 处理
            set $new_fastcgi_script_name $fastcgi_script_name;
            if (!-e $document_root$fastcgi_script_name) {
                set $new_fastcgi_script_name "/index.php";
            }
    
            fastcgi_param SCRIPT_FILENAME $document_root$new_fastcgi_script_name;
            fastcgi_param SCRIPT_NAME $new_fastcgi_script_name;
        }
    
        location /nginx_status {
            stub_status on;
            access_log off;
            allow 127.0.0.1;
            deny all;
        }
    
        location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
        {
            if (!-e $request_filename) {
                rewrite ^/(uploads/.*)$ /pic.php?$1 last;
            }
            expires      30d;
        }
    
        location ~ .*.(js|css)?$
        {
            expires      7d; # 缓存7天
        }
    
        location ~ /.ht
        {
            deny all;
        }
    }
  • 相关阅读:
    IDEA激活
    Spring JDBC
    数据库连接池
    JDBC
    10个很实用Linux命令,千万不要错过
    Linux 下如何使用 alias 命令
    Linux 下如何使用 fc 命令
    Linux 下如何修改密码有效期?
    利用 tee 命令调试shell脚本中的管道
    ps 命令显示不完整的问题
  • 原文地址:https://www.cnblogs.com/cqingt/p/7885280.html
Copyright © 2011-2022 走看看