nginx配置文件什么的都跟老师一样,为什么输入网址之后访问的是我本地的nginx而不是tomcat?代码如下
来源:2-17 nginx反向代理服务器域名解析配置实操(linux系统同学看这节)

想当厨师的码农
2018-07-11
server {
listen 80;
autoindex on;
server_name www.imooc.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 / {
proxy_pass http://127.0.0.1:8080;
add_header Access-Control-Allow-Origin *;
}
}
下面是/etc/hosts的配置:
192.168.2.197 www.imooc.com
下面是访问截图:
求解答.
写回答
1回答
-
polo哦
2018-07-11
你是不是没有reload下nginx啊?另外如果你是window访问的话需要在window的hosts下也加192.168.2.197 www.imooc.com这个啊,你再试试
042018-07-11
相似问题