按照你的視頻一步步來,可是http://image.imooc.com/, 404 Not Found
来源:3-7 nginx反向代理服务器域名解析配置实操(windows)
qq_三鱼纹_03331073
2020-04-19
C:\Windows\System32\drivers\etc\hosts:
add one line:
127.0.0.1 image.imooc.com
D:\nginx-1.10.2\conf
nginx.conf, add one line:
include vhost/*.conf;
D:\nginx-1.10.2\conf\vhost\image.imooc.com.conf:
server {
listen 80;
autoindex off;
server_name image.imooc.com;
access_log D:\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 D:\ftpfile\img;
add_header Access-Control-Allow-Origin *;
}
}
D:\nginx-1.10.2\conf\vhost\tomcat.imooc.com.conf:
server {
listen 80;
autoindex on;
server_name tomcat.imooc.com;
access_log D:\access.log combined;
index index.html index.htm index.jsp index.php;
#error_page 404 /404.html;
if ( $query_string ~* “.[;’<>].” ){
return 404;
}
location / {
proxy_pass http://127.0.0.1:8080;
add_header Access-Control-Allow-Origin *;
}
}
沒有看出錯在哪裏 ?
1回答
-
geelylucky
2020-04-19
同学,http://image.imooc.com/需要访问具体的图片,比如
http://image.imooc.com/a.jpg,你需要在D:\ftpfile\img里面放上对应的a.jpg才能访问到。
或者你直接把autoindex on;设置为on
112020-04-24
相似问题