Thinkphp Nginx-Konfiguration neu schreiben, die Adresse ist eine zusätzliche .php
, http://localhost:7080/.php?m=...
nginx-Konfigurationsdatei
Server
{
listen 80;
#listen [::]:80;
server_name localhost 192.168.150.79 doc.mall.com;
index index.html index.htm index.php default.html default.htm default.php;
root /data/www/wwwroot/mall_doc;
#error_page 404 /404.html;
location / {
if (!-e $request_filename)
{
rewrite ^/index.php(.*)$ /index.php?s= last;
rewrite ^(.*)$ /index.php?s= last;
rewrite ^/(.*)$ /index.php/;
}
}
Standort ~ .php {
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
set $path_info "";
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name ;
set $path_info ;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log /data/www/wwwlogs/doc.mall.access_log;
}
rewrite ^/index.php(.*)$ /index.php?s=$1 last;
rewrite ^(.*)$ /index.php?s=$1 last;
rewrite ^/(.*)$ / index.php/$1;
Alle drei Methoden wurden ausprobiert
'URL_MODEL' => 2,
Die PHP-Version ist PHP 7.1.5
nginx-Version ist: nginx/1.12.0
Hat jemand diese Situation erlebt? Auf die
php-Version kann normal unter 5.6.9 zugegriffen werden
之前我配置THINKCMF的时候也出现过这个问题
后来找到问题是这个$_SERVER['SCRIPT_NAME'] 常量中的路径出现问题有2个解决放过
1.你修改常量中的数据
2.使用APACHE
目前就想到这2个方法
另外可以关注我的博客 PHP程序员学习笔记