The first one doesn’t matter – but to be honest you shouldn’t do it – you should create two configurations – one for the www.domain and one for domain. Choose one as canonical (the one you really
want users to see) and put the real configuration here. ServerName mydomain.com ServerAlias myotherdomain.com ServerAlias www. myotherdomain.com Include conf/ssl-conf/mydomain.com.conf RewriteEngine on RewriteRule (.*) https://www.mydomain.com/ $1 [R,L,NE] </VirtualHost> Now which use as the canonical domain is up to you….
<VirtualHost *:443> ServerName www.mydomain.com ServerAlias dev.mydomain.com ServerAlias test.mydomain.com ServerAlias my-sandbox-server.mydomain.com ServerAlias freds-sandbox-server.mydomain.com Include conf/ssl-conf/mydomain.com.conf
From: Jason Long <hack3rcon@xxxxxxxxx.INVALID>
Hello, I have some questions about Apache configuration and I'm thankful if anyone help me. 1- In Apache configuration, both of "ServerName" and "ServerAlias" must be defined? Which one must have "www" prefix? 2- If "/etc/pki/tls/private/localhost.key" and "/etc/ssl/certs/localhost.crt" files deleted then how can I regenerate them? Is below command OK? # openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/pki/tls/private/localhost.key -out /etc/ssl/certs/localhost.crt The "localhost" is the name of my host? If my hostname is "example-test" then these files name must be "example-test.key" and "example-test.crt" ? 3- By default, Linux use "localhost.localdomain" if I installed Apache and my web site is up too then can I change "localhost.localdomain" ? 4- For a web site with the name "example-test.net" and "192.168.1.2" IP address, what is the content of "/etc/hostname" and "/etc/hosts" files? It is a great help if anyone answer my questions by number. Thank you. |