skyboy2018
V2EX  ›  问与答

如何实现隐藏 php 的扩展名访问

  •  
  •   skyboy2018 · Jan 1, 2017 · 2489 views
    This topic created in 3452 days ago, the information mentioned may be changed or developed.

    我按网上的做法,改了下 nginx 配置,结果不行,访问这个没有扩展名的 php 文件,出现文件下载框.

    location ~ (|.php)$ {
           include snippets/fastcgi-php.conf;
        #
        #       # With php7.0-cgi alone:
        #       fastcgi_pass 127.0.0.1:9000;
        #       # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
            #  fastcgi_index /index.php;
    
       # include fastcgi_params;
       # fastcgi_split_path_info       ^(.+\.php)(/.+)$;
       # fastcgi_param PATH_INFO       $fastcgi_path_info;
       # fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
       # fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }
    
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   931 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 20:23 · PVG 04:23 · LAX 13:23 · JFK 16:23
    ♥ Do have faith in what you're doing.