Forum Moderators: phranque
<VirtualHost *:80>
ServerAdmin webmaster@test
ServerName test
ServerAlias test
DocumentRoot /var/www/test/public_html
<Directory />
AllowOverride All
</Directory>
<Directory /var/www/test/public_html>
Options Indexes FollowSymLinks MultiViews
AllowOverride all
Require all granted
</Directory>
ErrorLog /var/log/apache2/test-error.log
LogLevel error
CustomLog /var/log/apache2/test-access.log combined
</VirtualHost> [edited by: not2easy at 4:56 pm (utc) on Apr 9, 2022]
[edit reason] delinked for readability [/edit]
I've added a test.conf to sites-available
If I enter 127.0.0.1/test/public_html, the new test website appears in the web browser.
The problem is that when I try to go to it in my web browser, I get a Not Found.
<Directory />
AllowOverride All
</Directory>
<Directory />
AllowOverride None
</Directory>
<VirtualHost *:80>
ServerAdmin webmaster@test
ServerName www.project1.test
DocumentRoot /var/www/foxclone/public_html
<Directory /var/www/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/project1-error.log
LogLevel error
CustomLog /var/log/apache2/project1-access.log combined
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster@test
ServerName www.project2.test
DocumentRoot /var/www/test/public_html
<Directory /var/www/public_html>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/apache2/project2-error.log
LogLevel error
CustomLog /var/log/apache2/project2-access.log combined
</VirtualHost>
If there is no specific vHost defined to catch the request then the "default" (first defined) vHost (or main server config) will catch the request.