使用路徑時 Apache 虛擬主機載入錯誤頁面

使用路徑時 Apache 虛擬主機載入錯誤頁面

我在我的 Apache 伺服器 (RedHat) 上設定了許多虛擬主機,在使用路徑之前它們都正常運作。解釋。

我有:

  • https://myserver1.com(預設網站)
  • https://myserver2.com
  • https://myserver3.com

但是當使用者登陸其中任何一個時,他們會得到正確的頁面,並且 URL 會附加到 /PORTAL/STARTUP.php

但是,如果用戶隨後為其頁面添加書籤,例如 https://myserver3.com/PORTAL/STARTUP.php,他們將登陸預設站點,但具有正確的 URL。

我錯過了什麼?

<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver1
    ServerName myserver1. com
    ErrorLog logs/myserver1-error_log
    CustomLog logs/myserver1-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver2
    ServerName myserver2.com
    ErrorLog logs/myserver2-error_log
    CustomLog logs/myserver2-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/myserver3
    ServerName myserver3.com
    ErrorLog logs/myserver3_error_log
    CustomLog logs/myserver3_access_log common
</VirtualHost>

更新

<VirtualHost 111.111.111.111:80>
        ServerAlias *
        RewriteEngine On
        RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]
</VirtualHost>

<VirtualHost 111.111.111.111:80>
        ServerAlias *
        RewriteEngine On
        RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [redirect=301]
</VirtualHost>

<filesMatch "\.(html|htm|js|css|png)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>

Header set X-Permitted-Cross-Domain-Policies: "master-only"
Header always set X-Frame-Options SAMEORIGIN
Header set X-XSS-Protection: "1; mode=block"
Header set Access-Control-Allow-Origin "*"

<VirtualHost *:80>
    ServerName clientA.com
    DocumentRoot /var/www/html
    ErrorLog logs/clientA.com-error_log
    CustomLog logs/clientA.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    ServerName clientB.com:443
    DocumentRoot /var/www/html
    Redirect / https://clientB.com/
    ErrorLog logs/clientB.error_log
    CustomLog logs/clientB.access_log common
</VirtualHost>

#<VirtualHost *:443>
   # DocumentRoot /var/www/html/clientC
    #ServerName www.clientC.com
    #ErrorLog logs/clientB.com-error_log
    #CustomLog logs/clientB.com-access_log common
#</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientD
    ServerName clientD.com
    ErrorLog logs/clientD.com-error_log
    CustomLog logs/clientD.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientE
    ServerName clientE.com
    ErrorLog logs/clientD.com-error_log
    CustomLog logs/clientD.com-access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientF
    ServerName clientF.com
    ErrorLog logs/clientF.com_error_log
    CustomLog logs/clientF.com_access_log common
</VirtualHost>

<VirtualHost *:443>
  DocumentRoot /var/www/html/clientG
  ServerName clientG.com
  ErrorLog logs/clientG_error_log
  CustomLog logs/clientG_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientH
    ServerName clientH.com
    ErrorLog logs/clientH_error_log
    CustomLog logs/clientH_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientI
    ServerName clientI.com
    ErrorLog logs/clientI_error_log
    CustomLog logs/clientI_access_log common
</VirtualHost>

<VirtualHost *:443>
    DocumentRoot /var/www/html/clientJ
    ServerName clientJ.com
    ErrorLog logs/error_log
    CustomLog logs/access_log common
</VirtualHost>

<VirtualHost *:443>
    ProxyPreserveHost On
    ProxyPass / http://111.111.111.111/
    ProxyPassReverse / http://11.111.111.111/
    ServerName clientK.com
    ErrorLog logs/clientK_error_log
    CustomLog logs/clientK_access_log common
</VirtualHost>

然後上面的虛擬主機條目透過 J 繼續到客戶端

相關內容