I have multiple websites supposed to run each with its own domain (e.g. site1.com, differentsite2.com, othersite3.com etc.). The operative directories of each website are dedicated subfolder in /var/www/html/



The virtual host for each website is something like

<VirtualHost *:80>
    ServerName site1.com
    ServerAlias www.site1.com
    DocumentRoot /var/www/html/site1
    <Directory /var/www/html/site1>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all

with a dedicated config file in /etc/apache2/sites-available/ enabled with a2ensite command and the default config disabled with a2dissite 000-default.conf

others website are configured in a similar way with

<VirtualHost *:80>
    ServerName site2.com
    ServerAlias www.site2.com
    DocumentRoot /var/www/html/site2



When I open www.site1.com rather than showing index in its DocumentRoot at /var/www/html/site1/index as supposed, It shows the index in main root at /var/www/html/index

Could someone help he to understand the issue?

  • Can you also provide the output from the logs? – Tommiie Dec 1 '20 at 13:01
  • 1
    You may want to use mod_info to show you the server configuration, to be sure the VirtualHost directives are being processed. – Andrew Schulman Dec 1 '20 at 13:10

The issue was caused by the fact Apache server was configured on port 8080 and Nginx on port 80 so when I invoked the site on port 80 the invocation was processed by Nginx.

  • Can you mark this answer as the accepted solution? Perhaps include a few commands and their output which you used to troubleshoot and determine this root cause. – Simba Dec 1 '20 at 16:23
  • 1
    @Simba yes but StackExchange needs some time before allow me to mark the accepted answer. – AndreaF Dec 1 '20 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.