我用ngrok将虚拟机ip:8080变为了外网可访问的域名,但是nginx的代理域名又不起作用了
来源:2-17 nginx反向代理服务器域名解析配置实操(linux系统同学看这节)

For_the_Horde
2017-05-10
nginx.conf文件已加入
include vhost/*.conf
hosts文件如下
#centos
zatin.ngrok.cc www.zatin1314.com
zatin.ngrok.cc image.zatin1314.com
zatin.ngrok.cc s.zatin1314.com
server {
default_type 'text/html';
charset utf-8;
listen 80;
autoindex on;
server_name www.zatin1314.com;
access_log /usr/local/nginx/logs/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://zatin.ngrok.cc;
add_header Access-Control-Allow-Origin '*'; }
}
~
1回答
-
Geely
2017-05-10
hi 你好~~ngrok变外网的话,因为host是本机的,是一个伪域名...所以不会生效的同学。课程是使用natapp做外网穿透的
00
相似问题