简体   繁体   English

如何创建可以显示其他本地网页的网页

[英]how to create a webpage that can display other local webpages

I have a bunch of websites running on various ports that are accessible on my lan, I want to be able to access these sites from a central webpage from the internet without the sites being access directly (I only want port 80 open to the wan). 我有一堆网站运行在局域网上可以访问的各种端口上,我希望能够从Internet的中央网页访问这些站点,而无需直接访问这些站点(我只希望80端口开放给WAN) 。 I guess it is like a web portal to my intranet 我想这就像我的Intranet的门户网站

I hope that make sense. 我希望这是有道理的。

I figure it would need to do something along the lines of a iframe with url to the internal site, however this obviously wont work as html is processed on the client side. 我认为这需要沿着iframe的内部URL进行一些操作,但是由于html是在客户端处理的,因此这显然行不通。

from previous experience there is always away, maybe with php??? 从以前的经验总是有可能离开,也许与PHP ???

That is were I need your help, any suggestions of a nudge in the right direction would be much appreciated. 那就是我需要您的帮助,朝正确方向轻推的任何建议将不胜感激。

You can create a web page with content of any URL using PHP. 您可以使用PHP创建包含任何URL内容的网页。

Create .php files for each local sites: 为每个本地站点创建.php文件:

in site1.php 在site1.php中

<?php
$content = file_get_contents('http://you_local_url:any_port');
echo $content;

in site2.php 在site2.php中

<?php
$content = file_get_contents('http://you_another_local_url:any_port');
echo $content;

Then, create a index.html file 然后,创建一个index.html文件

<!DOCTYPE html>
<head>
...
<a href="site1.php">Site1</a>
<a href="site2.php">Site2</a>
...
</html>

Use index.html on 80 port to show any local sites. 在80端口上使用index.html可以显示任何本地站点。

But this shows only first pages of the sites :( 但这只显示网站的首页:(

If I understood your request correctly, the best way to achieve that is configuring your webserver (IIS, Apache, or whatever is used as the local web server) to load the websites as different subdirectories of your domain, instead of different ports. 如果我正确理解了您的请求,那么实现此目标的最佳方法是将Web服务器(IIS,Apache或用作本地Web服务器的任何服务器)配置为将网站加载为域的不同子目录,而不是不同的端口。 and then you can have access to all websites at port 80. 然后您就可以访问端口80上的所有网站。

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

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