In apache, I would like to setup "ip-based" hosting for 2 sites and enable SSL for them. However, I'm not clear on how to configure httpd.conf file.
Questions:
1) Do I need a NameVirtualHost directive for ip-based setup? On Apache's site, it say it's required for name-based but there's no mention of ip-based.
2) If NameVirtualHost required, must the number of description and quantity match the number of VirtualHost directives? Example, can I say "NameVirtualHost *:80" and later use and ? Or, will I need "NameVirtualHost IP_ADDRESS_1:80" and "NameVirtualHost IP_ADDRESS_2:80"
3) If ServerName were example1.com (without "www"), would it make a difference??
4) In VirtualHost, do I need to set a value for ServerAlias, such as the IP itself?
One thing I'll to share is if you have (and likely including) ssl.conf, you should not add "Listen 443" to your httpd.conf, otherwise upon reload, apache will throw a "Address already in use: make_sock: could not bind to address [::]:443" error.
#see above questions about below directive
#NameVirtualHost *:80
#NameVirtualHost *:443
...
<VirtualHost IP_ADDRESS_1:80>
DocumentRoot /www/example1
ServerName www.example1.com
</VirtualHost>
<VirtualHost IP_ADDRESS_2:80>
DocumentRoot /www/example2
ServerName www.example2.org
</VirtualHost>
<VirtualHost IP_ADDRESS_1:443>
DocumentRoot /www/example1
ServerName www.example1.com
SSLEngine on
SSLProtocol all
SSLCertificateFile /home/web/example1_certs/public.crt
SSLCertificateKeyFile /home/web/example1_certs/private.key
SSLCACertificateFile /home/web/example1_certs/intermediate.crt
</VirtualHost>
<VirtualHost IP_ADDRESS_2:443>
DocumentRoot /www/example2
ServerName www.example2.org
#yes, in below, I'm using example1.com's certificate, which will throw a browser warning.. that's intentional
SSLEngine on
SSLProtocol all
SSLCertificateFile /home/web/example1_certs/public.crt
SSLCertificateKeyFile /home/web/example1_certs/private.key
SSLCACertificateFile /home/web/example1_certs/intermediate.crt
</VirtualHost>