如何在GCP上使用NGINX从外部ip访问内部ip?

时间:2019-05-12 07:16:24

标签: nginx networking google-cloud-platform centos

无法通过外部IP连接到应用程序。

我在GCP的vm实例(CentOS 7)上启动了Gerrit代码检查应用程序。它可以在http://localhost:8080上运行,我无法通过外部IP连接到它,但是在本地控制台中,通过ping curl http://localhost:8080可以正常工作。我也尝试创建NGINX服务器。安装NGINX后,启动页面显示在外部ip上,但是revere代理配置不显示gerrit注册页面。

server {
listen 80;

access_log /var/log/nginx/gerrit_access.log;
error_log /var/log/nginx/gerrit_error.log;

location / {
    proxy_pass   http://127.0.0.1:8080;
    index  index.html index.htm;
    try_files $uri $uri/ =404;
}
}

gerrit.config
[httpd]
listenUrl = proxy-http://127.0.0.1:8080/

最后,我想在外部ip上查看gerrit注册页面。

0 个答案:

没有答案
相关问题