nginx作為反向代理訪問靜態資源出現404問題
阿新 • • 發佈:2019-02-08
我的xxx.conf配置(win10)
server {
listen 80;autoindex off;
server_name image.imooc.com;
access_log c:/access.log combined;
index index.html index.htm index.jsp index.php;
#error_page 404 /404.html;
if ( $query_string ~* ".*[\;'\<\>].*" ){
return 404;
}
location ~ /(mmall_fe|mmall_admin_fe)/dist/view/* {
deny all;
}
location / {
root X:\xxx\img;
add_header Access-Control-Allow-Origin *;
}
}
然後通過cmd的nginx.exe -t 和 nginx.exe -s reload後 可以本地訪問到