V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
skyboy2018
V2EX  ›  问与答

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

  •  
  •   skyboy2018 · Jan 1, 2017 · 2413 views
    This topic created in 3406 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   ·   2429 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 11:05 · PVG 19:05 · LAX 04:05 · JFK 07:05
    ♥ Do have faith in what you're doing.