nginx 支持pathinfo

错误描述:1,打开网页,页面提示不支持pathinfo

2,类似index.php/hellworld会提示找不到页面

解决办法:1,修改nginx.conf的server{}中的内容下:

75#passthePHPscriptstoFastCGIserverlisteningon127.0.0.1:9000

76#

77location~\.php{

78roothtml;

79fastcgi_pass127.0.0.1:9000;

80fastcgi_indexindex.php;

81fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;

82includefastcgi_params;

83#pathinfosupport

84set$real_script_name$fastcgi_script_name;

85set$path_info"";

86if($fastcgi_script_name~"^(.+?\.php)(/.+)$"){

87set$real_script_name$1;

88set$path_info$2;

89}

90

91fastcgi_paramSCRIPT_NAME$real_script_name;

92fastcgi_paramPATH_INFO$path_info;

93

94}

ps:红色部分为笔者改动的部分

相关推荐