2
votes

Hello I am trying to set up an apache server on a PC.(PC A) I created the folder /var/www/test. In this folder I have my index.html. I created a conf file test.conf in the /etc/apache2/sites-available folder with the following entries:

    <VirtualHost www.test.tld:80>
    ServerName www.test.tld
    DocumentRoot /var/www/test
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

   </VirtualHost>

This is my /etc/hosts file:

  ::1     ip6-localhost ip6-loopback www.test.tld

Now when I open www.test.tld from this pc (PC-A), I could see the index.html file. But when I try to open this URL from another PC (say PC- B) I see the directory structure of the folder /var/www/html of PC- A.

I have added the following entry of PC -A in the /etc/hosts of PC-B and able to ping them.

    IPv6 address www.test.tld

Any idea where I am I going wrong so that I can see the index.html from PC-B as well. I also ran sudo a2dissite 000-default.conf. After this in my folder /etc/apache2/sites-enabled, I just see the entry of test.conf. Then I ran sudo service apache2 reload, but still to my surprise, I still see the directory structure of /var/www/html when I try to reach this URL from PC B. Deleting the browser cache also didnt help.

1

1 Answers

2
votes

I think the /etc/hosts file configuration for the PC-A is not correct.

      ::1     ip6-localhost ip6-loopback www.test.tld

The above mentioned entry seems to be problematic. Instead of that please point the IPv6 address of PC-A to www.test.tld and remove the entry for the www.test.tld from the loopback address.