403问题
来源:11-5 nginx和域名的配置

悟空工作室
2019-03-27
老师您好:
最近项目部署到服务器遇到403问题
项目目录:
/product/frontend/seeshu_manager_fe/dist
admin.xxx.com.conf
server {
listen 80;
autoindex on;
server_name admin.xxx.com;
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.jsp index.php;
#root /devsoft/apache-tomcat-7.0.73/webapps/mmall;
#error_page 404 /404.html;
if ( $query_string ~* ".*[\;'\<\>].*" ){
return 404;
}
location = / {
root /product/frontend/seeshu_manager_fe/dist;
index index.html;
}
location ~ .*\.(html|htm)$ {
root /product/frontend/seeshu_manager_fe/dist;
index index.html;
}
location ~ .*\.do$ {
proxy_pass http://xx.xx.xx.xx;
}
location / {
try_files $uri $uri/ /index.html;
}
}
s.xxx.com.conf
server {
listen 80;
autoindex off;
server_name s.xxx.com;
access_log /usr/local/nginx/logs/access.log combined;
index index.html index.htm index.jsp index.php;
if ( $query_string ~* ".*[\;'\<\>].*" ){
return 404;
}
location ~ /seeshu_manager_fe/dist/* {
deny all;
}
location / {
root /product/frontend/;
add_header 'Access-Control-Allow-Origin' '*';
}
}
浏览器访问时报如下错误
GET http://s.xxx.com/seeshu_manager_fe/dist/css/main.css net::ERR_ABORTED 403 (Forbidden)
2admin.wukongwork.com/:15
GET http://s.xxx.com/seeshu_manager_fe/dist/js/app.js net::ERR_ABORTED 403 (Forbidden)
favicon.ico:1
GET http://s.xxx.com/seeshu_manager_fe/dist/favicon.ico 403 (Forbidden)
title能正常显示,我实在找不出原因了,晕了,希望老师能帮帮忙!
写回答
2回答
-
location ~ /seeshu_manager_fe/dist/* { deny all; }
你这条规则是把/seeshu_manager_fe/dist/路径下所有东西都拒绝了,所以403吧,想下这的逻辑有问题么
012019-03-28 -
Rosen
2019-03-28
应该是你目录没有权限,或者指定的文件路径有问题。仔细查查,实在找不着把你服务器帐号发我看看
00
相似问题