skyboy2018
V2EX  ›  问与答

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

  •  
  •   skyboy2018 · Jan 1, 2017 · 2481 views
    This topic created in 3446 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   ·   1694 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:30 · PVG 00:30 · LAX 09:30 · JFK 12:30
    ♥ Do have faith in what you're doing.