Deservesc 3 site-uri web NodeJS pe Apache. VirtualHost-urile acestor site-uri web sunt după cum urmează:
site-ul web1
<VirtualHost *:80>
DocumentRoot "/var/www/html/[website1]"
ServerName "[website1_domain]"
ServerAlias "www.[website1_domain]"
ProxyPass / http://localhost:[website1_port]/
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.[website1_domain] [OR]
RewriteCond %{SERVER_NAME} =[website1_domain]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
site-ul web2
<VirtualHost *:80>
DocumentRoot "/var/www/html/[website2]"
ServerName "[website2_domain]"
ServerAlias "www.[website2_domain]"
ProxyPass / http://localhost:[website2_port]/
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.[website2_domain] [OR]
RewriteCond %{SERVER_NAME} =[website2_domain]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
site-ul web3
<VirtualHost *:80>
DocumentRoot "/var/www/html/[website3]"
ServerName "[website3_domain]"
ServerAlias "www.[website3_domain]"
ProxyPass / http://localhost:[website3_port]/
RewriteEngine on
RewriteCond %{SERVER_NAME} =www.[website3_domain] [OR]
RewriteCond %{SERVER_NAME} =[website3_domain]
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
De exemplu, dacă merg la website1_domain astfel http://[domeniu_site1]:[port_site2]
site-ul web2
se deschide chiar dacă domeniul este website1_domain
.
Cum pot preveni acest lucru? Dacă am de gând website1_domain
Vreau http://localhost:[website1_port]/
a alerga direct.