为什么nginx URL不';最后没有斜线不行吗?
我正试图通过以下地址访问我的web应用程序: 但它不起作用 只要我最后通过斜杠,我就可以访问: 我试图检查curl命令的输出,它正在从 到 但重定向后,应用程序不会运行。我刚在浏览器中发现一个错误: “拒绝连接”。Nginx服务正在运行-t输出正确 如何改变这种行为 这是我的nginx完整配置:为什么nginx URL不';最后没有斜线不行吗?,nginx,url,webserver,Nginx,Url,Webserver,我正试图通过以下地址访问我的web应用程序: 但它不起作用 只要我最后通过斜杠,我就可以访问: 我试图检查curl命令的输出,它正在从 到 但重定向后,应用程序不会运行。我刚在浏览器中发现一个错误: “拒绝连接”。Nginx服务正在运行-t输出正确 如何改变这种行为 这是我的nginx完整配置: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/ngin
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
# configuration file /etc/nginx/nginx.conf:
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
# include /etc/nginx/sites-enabled/*;
#include /etc/nginx/conf.d/*.conf;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
# configuration file /etc/nginx/conf.d/default.conf:
server {
listen 80;
server_name 127.0.0.1 localhost;
root /usr/share/nginx/html;
index index.php index.html index.htm index.nginx-debian.html;
location /rukovoditel {
# root /usr/share/nginx/html;
index index.php index.htm index.nginx-debian.html;
}
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_intercept_errors on;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}
你需要查看访问日志和错误日志。访问日志显示,当我试图在没有斜杠的情况下访问时,我得到一个错误301。