main domain and sub-domain are promiscuous
I want to add sub.mysite.com for another virtual host on my host.
I follow
****a2ensite sub.mysite.com
/etc/init.d/apache2 restart****
some users of
Why the users of
–-------------------------------------------------
Some informations:
My A Records is:
Hostname IP Address TTL Options
96.126.98.96 Default Edit | Remove
sub 96.126.98.96 Default Edit | Remove
mail 96.126.98.96 Default Edit | Remove
www 96.126.98.96 Default Edit | Remove
my hostname is mysite, and my /etc/hosts is
127.0.0.1 localhost.localdomain localhost
96.126.98.96 mysite.mysite.com mysite
apache2ctl -S:
VirtualHost configuration:
wildcard NameVirtualHosts and default servers:
*:443 is a NameVirtualHost
default server mysite.com (/etc/apache2/sites-enabled/mysite.com:10)
port 443 namevhost mysite.com (/etc/apache2/sites-enabled/mysite.com:10)
*:80 is a NameVirtualHost
default server sub.mysite.com (/etc/apache2/sites-enabled/sub.mysite.com:1)
port 80 namevhost sub.mysite.com (/etc/apache2/sites-enabled/sub.mysite.com:1)
port 80 namevhost mysite.com (/etc/apache2/sites-enabled/mysite.com:1)
cat /etc/apache2/sites-enabled/mysite.com
ServerName mysite.com
ServerAlias
DocumentRoot /srv/www/mysite.com/public_html/
ErrorLog /srv/www/mysite.com/logs/error.log
CustomLog /srv/www/mysite.com/logs/access.log combined
SSLCertificateFile /etc/apache2/ssl/apache.pem
SSLCertificateKeyFile /etc/apache2/ssl/apache.key
ServerAdmin
ServerName mysite.com
ServerAlias
DocumentRoot /srv/www/mysite.com/public_html/
ErrorLog /srv/www/mysite.com/logs/error.log
CustomLog /srv/www/mysite.com/logs/access.log combined
cat /etc/apache2/sites-enabled/sub.mysite.com
ServerName sub.mysite.com
ServerAlias
DocumentRoot /srv/www/sub.mysite.com/public_html/
DocumentRoot /srv/www/mysite.com/public_html/sub
ErrorLog /srv/www/sub.mysite.com/logs/error.log
CustomLog /srv/www/sub.mysite.com/logs/access.log combined
1 Reply
Some users access my main domain site with IP directly.
In apache2ctl -S result, we can see
default server sub.mysite.com
According apache explanation, the first
In my server, /etc/apache2/sites-enabled, rename mysite.com to 000mysite.com will make it be loaded before sub.mysite.com (in my site, "sub" is "f*")