配置nginx后,发现TP接口无法正常访问
默认情况下的ip/think 也无法访问,推测Nginx异常
查找后,发现是2行nginx配置导致,删除后访问正常
异常配置:
server {
listen 8082;
access_log /data/www/log/sandbox.log combined;
error_log /data/www/log/sandbox_error.log;
root /www/xdnice_local/public;
set $root /www/xdnice_local/public;
location ~ \.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
fastcgi_split_path_info ^((?U).+.php)(/?.+)$; #异常1
fastcgi_param PATH_INFO $fastcgi_path_info; #异常2
fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}
location / {
root $root;
index index.html index.php;
if ( -f $request_filename) {
break;
}
if ( !-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
break;
}
}
}
删除2处异常后,正常访问
server {
listen 8082;
access_log /data/www/log/sandbox.log combined;
error_log /data/www/log/sandbox_error.log;
root /www/xdnice_local/public;
set $root /www/xdnice_local/public;
location ~ \.php {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.3-fpm.sock;
fastcgi_param SCRIPT_FILENAME $root$fastcgi_script_name;
include fastcgi_params;
}
location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$
{
root $root;
}
location / {
root $root;
index index.html index.php;
if ( -f $request_filename) {
break;
}
if ( !-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
break;
}
}
}
image.png
网友评论