老师,上传文件后,这个地址不能访问http://img.happymmall.com/
来源:8-2 后台商品新增,保存,更新,上下架功能开发

慕容3584850
2018-07-21
2回答
-
慕粉3399548
2018-07-21
首先保证nginx正常启动,浏览器里面127.0.0.1能看到nginx首页。
确保nginx/conf/vhost/img.happymmall.com.conf里面的配置写对:
server {
listen 80;
autoindex off;
server_name image.mmall.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 C:\ftpfile\img;//要转发的文件目录
add_header Access-Control-Allow-Origin *;
}
}
3.例如上面的配置,在浏览器输入:image.mmall.com/boy.jpg就能看到图片了。
你可能是把服务名输成2中的文件名了。
10 -
慕斯0312332
2018-08-09
遇到这种问题,先看http返回的状态码,是哪一步断的,一般来说不能访问就是你的反向代理服务器的conf文件没有正确配置,如果保证配置正确,可以尝试开启匿名访问解决
00
相似问题