我的网站(生产和分期)都托管在Apache服务器(IP-12.345.456.678)中
DNS映射 12.345.456.678-www.site1.com , 12.345.456.678-staging.site1.com
我现在需要将托管在不同apache服务器(IP-87.65.654.321)中的另一个站点(产品和登台)重定向到上面,以便我可以关闭此服务器。
DNS映射 87.65.654.321-www.site2.in , 87.65.654.321-staging.site2.in
因此,我要做的是将 staging.site2.in 中的DNS映射到 12.345.456.678 。
截至目前,它正在重定向到“ www.site1.com”,而不是“ staging.site1.com”
我启用了如下所示的新配置文件,但仍然无法重定向。
<VirtualHost *:80>
ServerName staging.site2.in
Redirect permanent / https://staging.site1.com/
</VirtualHost>
<VirtualHost *:443>
ServerName staging.site2.in
DocumentRoot /var/www/html/site1staging
<Directory /var/www/html/site1staging>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Protocols h2 h2c http/1.1
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
Ubuntu-16.04,Apache服务器-v2.4
配置详细信息-生产[站点1]
<VirtualHost *:80>
ServerName www.site1.com
Redirect permanent / https://www.site1.com/
</VirtualHost>
<VirtualHost *:443>
ServerName www.site1.com
DocumentRoot /var/www/html/site1
SSLEngine On
<Directory /var/www/html/site1>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Protocols h2 h2c http/1.1
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
配置详细信息-暂存[站点1]
<VirtualHost *:80>
ServerName staging.site1.com
Redirect permanent / https://staging.site1.com/
</VirtualHost>
<VirtualHost *:443>
ServerName staging.site1.com
DocumentRoot /var/www/html/site1staging
SSLEngine On
<Directory /var/www/html/site1staging>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Protocols h2 h2c http/1.1
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>