ubuntu - Apache2 virtual host missing Document Root -
thank in advance.
i following tutorial digitalocean : https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts . completed instruction when start test configuration , add record parking domain, let example.com , digitalocean vps address 192.168.10.2. in schenario add these 3 virtual host 3 different documentroot:
- /var/www/domainone.example.com/index.html
- /var/www/domaintwo.example.com/index.html
- /var/www/domainthree.example.com/index.html
then in parking domain add 3 different record below :
- name : domainone.example.com address : 192.168.10.2
- name : domaintwo.example.com address : 192.168.10.2
- name : domainthree.example.com address : 192.168.10.2
when execute, happens follow :
- url domainone.example.com goes /var/www/domainone.example.com/index.html
- url domaintwo.example.com goes /var/www/domaintwo.example.com/index.html
- but url domainthree.example.com goes /var/www/domaintwo.example.com/index.html
i sure wrote correct documentroot @ /etc/apache2/sites-available/(for each domain).config , restart apache2 service
thank again
edit
this /etc/apache2/sites-available/domaintwo.example.com.conf
<virtualhost *:80> # servername directive sets request scheme, hostname , port # server uses identify itself. used when creating # redirection urls. in context of virtual hosts, servername # specifies hostname must appear in request's host: header # match virtual host. default virtual host (this file) # value not decisive used last resort host regardless. # however, must set further virtual host explicitly. #servername www.example.com serveradmin localhost@admin documentroot /var/www/domaintwo.example.com/public servername domaintwo.example.com serveralias www.domaintwo.example.com # available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # possible configure loglevel particular # modules, e.g. #loglevel info ssl:warn errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined # configuration files conf-available/, # enabled or disabled @ global level, possible # include line 1 particular virtual host. example # following line enables cgi configuration host # after has been globally disabled "a2disconf". #include conf-available/serve-cgi-bin.conf sslengine on
sslcertificatefile /etc/apache2/ssl/apache.crt sslcertificatekeyfile /etc/apache2/ssl/apache.key
this /etc/apache2/sites-available/domainthree.example.com.conf
<virtualhost *:80> # servername directive sets request scheme, hostname , port # server uses identify itself. used when creating # redirection urls. in context of virtual hosts, servername # specifies hostname must appear in request's host: header # match virtual host. default virtual host (this file) # value not decisive used last resort host regardless. # however, must set further virtual host explicitly. #servername www.example.com serveradmin localhost@admin documentroot /var/www/domainthree.example.com/public servername domainthree.example.com serveralias www.domainthree.example.com # available loglevels: trace8, ..., trace1, debug, info, notice, warn, # error, crit, alert, emerg. # possible configure loglevel particular # modules, e.g. #loglevel info ssl:warn errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined # configuration files conf-available/, # enabled or disabled @ global level, possible # include line 1 particular virtual host. example # following line enables cgi configuration host # after has been globally disabled "a2disconf". #include conf-available/serve-cgi-bin.conf sslengine on sslcertificatefile /etc/apache2/ssl/apache.crt sslcertificatekeyfile /etc/apache2/ssl/apache.key </virtualhost>
Comments
Post a Comment