Apache虚拟主机重定向

时间:2019-07-16 08:03:54

标签: apache

我已经安装并配置了一个Apache Web服务器,我有多个虚拟主机,每个虚拟主机都有自己的子域,目前这些主机对具有该地址的任何人都是可见的,我想创建一个登陆站点,然后重定向到每个单独的子域从那里。

Ubuntu 18.4服务器操作系统 具有重定向路由的Apache 2虚拟主机

<VirtualHost *:80>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself.
        ServerName api.zematoxic.com
        # Enable Proxy
        ProxyPreserveHost On
        # Setup proxy pass
        ProxyPass / http://localhost:3001/
        # Setup reverse proxy
        ProxyPassReverse / http://localhost:3001/
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =www.zematoxic.com
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

<VirtualHost *:80>
        # The sub domain to use
        ServerName uploads.zematoxic.com
        # Enable Proxy
        ProxyPreserveHost On
        # Setup Proxy
        ProxyPass / http://localhost:3030/
        # Setup reverse Proxy
        ProxyPassReverse / http://localhost:3030/
        RewriteEngine on
        RewriteCond %{SERVER_NAME} =www.zematoxic.com
        RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

0 个答案:

没有答案