如何configuration子域在Apache中redirect到内部/本地IP

默认情况下,当我要去我的外部IP或无IP域我留在我的互联网路由器的页面上,直到我为我的网站设置Apache,并在路由器中打开端口80 …

我的问题是:
如何configurationredirect或redirect到我的路由器本地IP 192.168.1.254,在我的服务器机器192.168.1.104的Apache?

我的目标是创build一个像无线路由器router.example.com的子域,当我访问它出现我的路由器的login页面(IP在我家里是192.168.1.254)

我试过这个:

<VirtualHost *:80> ServerAdmin [email protected] ServerName router.example.com Redirect permanent / http://192.168.1.254 ErrorLog ${APACHE_LOG_DIR}/router-error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/router-access.log combined </VirtualHost> 

但不从外部工作…

(如果我正确地阅读了这个内容(而且我可能不是),那么你的路由器正在向前传送端口80上的所有stream量,并且你不能再从外面打你的路由器的页面,因为所有stream量都跳转到你的Apache服务器。

基于你的问题的后半部分,我认为你正在寻找mod_proxy ,而不是重写。 代理将允许您将stream量反弹回您的路由器,并提供您打算的路由器控制页面。

我对mod_proxy没有任何经验(在这种情况下,我倾向于使用nginx),但是粗略的看一下这个文档会提示这个configuration可以工作:

 ProxyPass / http://192.168.1.254 ProxyPassReverse / http://192.168.1.254 

这可能需要一些调整。