简体   繁体   English

如何在同一服务器上的另一个端口网站的nginx 80中显示数据?

[英]How I can display in nginx 80 data of another port website on the same server?

I have this: 我有这个:

location /cloud/ {
            proxy_pass http://localhost:8000;
    }

but I can't see in browser in url http://someipaddress/cloud/ content of http://someipaddress:8000 , why? 但我在浏览器中看不到URL http:// someipaddress / cloud / http:// someipaddress:8000的内容 ,为什么? someipaddress:8000 - works well. someipaddress:8000-效果很好。 I also can do wget of localhost:8000 and it works. 我也可以做localhost:8000的wget,它可以工作。 What I am doing wrong? 我做错了什么?

You want to see the content of http://123.123.123.123:8000/ whenever you point your browser to http://123.123.123.123/somepath/ . 你想看到的内容http://123.123.123.123:8000/只要您将浏览器指向http://123.123.123.123/somepath/

A quick solution would be to create a file "index.html" inside the "somepath" folder with an iframe occupying the whole browser viewport: 一种快速的解决方案是在“ somepath”文件夹中创建一个文件“ index.html”,其中iframe占据整个浏览器视口:

<html>
  <title>Redirecting</title>
  <body>
  <iframe src="http://123.123.123.123:8000/" width="100%" height="100%" style="padding: 0px; margin: 0px; border: 0px;"></iframe>
  </body>
</html>

What I understand is u have two urls 我了解的是您有两个网址

http://someipaddress/cloud/ and http://someipaddress:8000 http:// someipaddress / cloud /http:// someipaddress:8000

As per ur example. 按照您的示例。 However if u see the domain name is the same. 但是,如果您看到域名是相同的。 This makes it in my opinion a infinte loop. 我认为这是一个无限循环。

if u have to use the same domain name then try rewrite maybe it will work for you. 如果您必须使用相同的域名,请尝试重新编写,也许它将对您有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM