let’s say i have 2 domain and 1 ip address
my virtualhost configuration for domain-one.com :
<VirtualHost *:80> ServerName domain-one.com ServerAlias www.domain-one.com DocumentRoot /var/www/domain-one.com/html </VirtualHost> <VirtualHost *:443> ServerName domain-one.com ServerAlias www.domain-one.com DocumentRoot /var/www/domain-one.com/html SSLEngine on SSLCertificateFile *ssl_location* SSLCertificateKeyFile *ssl_location* SSLCertificateChainFile *ssl_location* </VirtualHost>
and virtualhost configuration for domain-two.com :
<VirtualHost *:80> ServerName domain-two.com ServerAlias www.domain-two.com DocumentRoot /var/www/domain-two.com/html </VirtualHost>
It works, but when i visit using ip address without https , apache will using domain-two.com virtualhost
and when i visit using ip address with https, apache will using domain-one.com virtualhost
the question is , is that possible using DocumentRoot /var/www/html when i visit ip address?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!