내 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를 통해 클라이언트로 이동합니다.