首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >apache虚拟主机重定向流量在LAN中工作,但在WAN中不起作用

问apache虚拟主机重定向流量在LAN中工作,但在WAN中不起作用
EN

Stack Overflow用户
提问于 2016-05-06 01:29:38
回答 1查看 378关注 0票数 0

我有一个由雅虎托管的域名。

但我正在使用自己的内部服务器来实际托管我的域和云子域。

所以在雅虎,我把所有的www.mydomain.com都转发到我的静态ip

代码语言:javascript
复制
<meta http-equiv="refresh" content="0; url=http://111.111.111.111">

以及我所有的子域流量到我的静态ip:

代码语言:javascript
复制
<meta http-equiv="refresh" content="0;URL=http://111.111.111.111/cloud"  />

我的内部服务器是运行在Ubuntu 14.04LTS上的Apache 2.4.7。我已经创建了一个虚拟主机站点并启用了它,只要我在局域网中,它就能很好地工作。但是,当我在WAN上时,web浏览器超时,提示服务器停止工作。我想我知道问题在哪里,但我不确定如何解决它,也就是重定向到htpps -我使用的是LAN IP。使用我的静态IP或域名并不能帮助我解决这个问题。这是我为虚拟主机启用的站点:

代码语言:javascript
复制
    <VirtualHost *:80>
       ServerAdmin admin@myexample.com
       ServerName www.myexample.com
       ServerAlias myexample.com

       DocumentRoot /var/www/html/example-test/

       Alias /   /var/www/html/example-test/

       ### Redirect /cloud   https://www.myexample.com/cloud
       Redirect /cloud   https://192.168.1.122/cloud
       ### Redirect /cloud   https://111.111.111.111/cloud

       <Directory /var/www/html/example-test>
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Require all granted
       </Directory>

       <Directory /var/www/owncloud>
          Options Indexes FollowSymLinks MultiViews
          AllowOverride All
          Require all granted
       </Directory>

       ErrorLog /var/log/apache_http_myexample.com.error.log
    </VirtualHost>


    ### <VirtualHost www.myexample.com:443>
    <VirtualHost 192.168.1.122:443>
    ### <VirtualHost 111.111.111.111:443>
       ServerAdmin admin@myexample.com
       ServerName www.myexample.com
       ServerAlias myexample.com

       Alias /cloud   /var/www/owncloud
       DocumentRoot /var/www/owncloud/
       ####Configuration for SSL #####
       SSLEngine on
       SSLCertificateFile /etc/apache2/ssl/examplecloud.pem
       SSLCertificateKeyFile /etc/apache2/ssl/examplecloud.key
       #### End of SSL Configuration ####


       <Directory /var/www/owncloud>
       Options Indexes FollowSymLinks MultiViews
       AllowOverride All
       Require all granted
       </Directory>

       ErrorLog /var/log/apache_https_cloud.myexample.com.error.log
    </VirtualHost>

~

任何帮助/见解都将不胜感激。

谢谢,

EN

回答 1

Stack Overflow用户

发布于 2016-05-07 13:18:21

试试Redirect permanent /cloud https://192.168.1.122/cloud

如果这样不起作用,请尝试更通用的解决方案,将重定向替换为:

RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/37056725

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档