簡體   English   中英

Apache重定向頁面到錯誤的虛擬主機

[英]Apache redirect page to bad vhost

在綁定中,我使用CNAME作為從old.domain.com到new.domain.com的重定向器,而old.domain也是我刪除的虛擬主機每個虛擬主機都具有HTTP重定向到https的重定向,但是問題是,在webbrowser中鍵入舊地址時,我會重定向到diff.domain.com,即使dig / nslookup看到dns cname。 當我禁用一個虛擬主機時,下一個diff2.domain.com將被重定向

<VirtualHost ip:80>
        ServerName diff.domain.com
        Redirect permanent / https://diff.domain.com/
</VirtualHost>

<IFModule mod_ssl.c>
        <VirtualHost ip:443>
                ServerAdmin webmaster@domain.com
                ServerName diff.domain.com:443
                DocumentRoot /var/www/diff/web
                <Directory "/var/www/diff/web">
                        Options FollowSymLinks
                        AllowOverride All
                        Order allow,deny
                        Allow from all
                        Require all granted
                </Directory>
                ErrorLog /var/www/diff/logs/error.log
                CustomLog /var/www/diff/logs/access.log combined
                SSLEngine on
                SSLCertificateFile      /etc/letsencrypt/live/diff/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/diff/privkey.pem
                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

                BrowserMatch "MSIE [2-6]" \
                                nokeepalive ssl-unclean-shutdown \
                                downgrade-1.0 force-response-1.0
                # MSIE 7 and newer should be able to use keepalive
                BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

                <IfModule mod_fastcgi.c>
                        AddType application/x-httpd-fastphp5 .php
                        Action application/x-httpd-fastphp5 /php5-fcgi
 Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi_diff
                        FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi_diff -socket /var/run/php5-fpm_diff.sock -pass-header Authorization
                 </IfModule>
        </VirtualHost>
</IFModule>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet

我用這個conf作為其他虛擬主機的模板,但似乎這里有錯誤/錯誤

Apache 2.4按順序讀取站點配置。 看起來在任何ServerName或ServerAlias中都沒有URL命中,因此apache加載首先讀取的站點配置為diff.domain。

我最終添加了ServerName,它代表了我想要的URL,並將其重定向到了我想要的站點。

這樣就可以確定頁面的位置。

CNAME指出IP在這種情況下與A記錄沒有什么不同。

現在我知道更多。 希望這會對以后的人有所幫助;-)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM