ysoserious
V2EX  ›  问与答

这两个 url 为什么一个正常一个 404 呢?

  •  
  •   ysoserious · Nov 11, 2019 · 1900 views
    This topic created in 2375 days ago, the information mentioned may be changed or developed.

    nginx 配置如下

    location / {
    	try_files $uri $uri/ =404;
    }
    
    location ~ \.php$ {
    	fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    	include fastcgi_params;
    
    	fastcgi_param PATH_INFO       $fastcgi_path_info;
    	fastcgi_index index.php;
    	fastcgi_param  REDIRECT_STATUS    200;
    	fastcgi_param  SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
    	fastcgi_param  DOCUMENT_ROOT /var/www/html;
    	fastcgi_pass php:9000;
    }
    

    nginx 日志

    "GET /index.php/PHP%0Ais_the_shittiest_lang.php HTTP/1.1" 200
    "GET /index.php/PHP%0ASOSAT HTTP/1.1" 404
    
    2 replies    2019-11-11 22:38:18 +08:00
    PHPer233
        1
    PHPer233  
       Nov 11, 2019 via Android
    第一个 url 匹配了*.php 规则,第二个 url 没匹配上*.php 规则,所以是 404。
    ysoserious
        2
    ysoserious  
    OP
       Nov 11, 2019
    @PHPer233 #1 忘了 $, 感谢提醒
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1398 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 17:05 · PVG 01:05 · LAX 10:05 · JFK 13:05
    ♥ Do have faith in what you're doing.