【发布时间】:2020-07-07 04:20:59
【问题描述】:
目前我的配置文件(/etc/nginx/sites-available/default)说
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;
server_name _;
location /credentials.js {
deny all;
return 404;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
但我仍然可以通过 web 上的 example.com/credentials.js 访问 credentials.js。有什么建议么?
【问题讨论】:
-
关于您可以访问的网址以及配置的其余部分是什么?
-
我已经用你的问题的答案更新了我的问题。
-
你能把整个
/credential.js块移到location /里面吗?再试一次 -
这并没有解决问题。结果相同。
-
运行
nginx -T并输出到您的问题