I am new to apache2 and I am getting some trouble configuring apache2 on Ubuntu Server 12.04 LTS. All the subdomain are pointing to the default one. Here is my objectives:
domain.com -> MAIN SITE (port 80)
sub1.domain.com -> SITE 1 (port 80)
sub2.domain.com -> SITE 2 (port 80)
SSL.domain.com -> SITE 3 (port 443)
but with my configuration, when i go for example to:
https://sub1.domain.com (port 443)
apache give me the SITE 3 which is not my way, i don't want any return on this subdomain on 443. How to configure well apache2 to have the good domain name pointing at the right SITE on appropriate port and don't answer if i don't want ? Here is a abstract of my site configuration: For main site :
<VirtualHost domain.com:80>
ServerAdmin [email protected]
ServerName domain.com
ServerAlias www.domain.com
DocumentRoot /var/www/default/public_html
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
Options -Indexes -ExecCGI
</Directory>
<Directory /var/www/default/public_html>
Order Allow,Deny
allow from all
Options -Indexes -ExecCGI
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined env=!local
</VirtualHost>
and for each subdomain:
<VirtualHost sub1.domain.com:80>
ServerAdmin [email protected]
ServerName sub1.domain.com
ServerAlias sub1.domain.com
DocumentRoot /var/www/sub1/public_html
<Directory />
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /var/www/sub1>
Order Deny,Allow
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /var/www/sub1/public_html>
Order Allow,Deny
allow from all
Options -Indexes -ExecCGI
</Directory>
ErrorLog ${APACHE_LOG_DIR}/sub1_error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/sub1_access.log combined env=!dontlog
</VirtualHost>
Thanks very in advance for help ! Have a nice day.