Apache was installed on my debian,i want to bind two domain name with different directroy.
cat /etc/hosts
127.0.0.1 hwy.local www.hwy.local
127.0.0.1 test.app www.test.app
Two domain name all binded with 127.0.0.1.
cat /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName www.hwy.local
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error_hwy.log
CustomLog ${APACHE_LOG_DIR}/access_hwy.log combined
<Directory /var/www/html>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.test.app
ServerAdmin webmaster@localhost
DocumentRoot /home/debian9/app
ErrorLog ${APACHE_LOG_DIR}/error_app.log
CustomLog ${APACHE_LOG_DIR}/access_app.log combined
<Directory /home/debian9/app>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
Save the same file test.html
in both /var/www/html
and /home/debian9/app
.
<p>it is a test</p>
Why www.hwy.local/test.html
can open it ,www.test.app
run into error.
This site can’t be reached
/var/log/apache2/error_app.log
and/var/log/apache2/access_app.log
. Also add the output ofnamei -olm /home/debian9/app/index.html
./home
instead of under/var/www/html
. Do a search for "apache directory permissions" on this site, and you'll find lots of similar questions that will help you.