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;
        }
    }
  • 相关阅读:
    CSS3新增文本属性
    CSS选择器
    【转】Java基础——面试题汇总
    【转】equals和==的区别
    【转】JRE和JDK的区别
    【转】深度学习常用的模型评估指标
    【转】使用Scanner输入字符串时next()和nextLine()区别
    JAVA操作ORACLE大对象
    ORACLE大对象存储
    iis是什么东西?
  • 原文地址:https://www.cnblogs.com/cqingt/p/7885280.html
Copyright © 2011-2022 走看看