K
K
kitoss2014-11-29 20:01:41
Apache HTTP Server
kitoss, 2014-11-29 20:01:41

Trying to get to the virtual host directory from the network, but I get to /var/www/html ?

I installed apache on CentOS 7 and decided to set up virtual hosts
at the end of the /etc/httpd/conf/httpd.conf file added the following lines:

<VirtualHost 127.0.1.1:80>
   ServerName test.com
   DocumentRoot /home/test.com
   ServerAlias www.test.com
   <Directory /home/test.com>
      Options FollowSymLinks
      AllowOverride all
      Order allow,deny
      Allow from all
   </Directory>
   ErrorLog /home/test.com/logs/error.log
</VirtualHost>

I added the following line in the hosts file:
127.0.1.1 test.com
The problem is that if I go to the test.com host from centos, I get where I need to (/home/test.com), and if I enter the host in another browser PC from the network, then I get to the Apache welcome page.
4cfdea9373174307b18dd25efe81a7c9.JPG

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Petrikov, 2014-11-29
@kitoss

Wangyu, remove the default config from conf.d. - this is so as not to fall into default, well, transfer the virtualhost to all IPs, and not just to the localhost.

T
ThemeZV, 2014-11-29
@ThemeZ

<VirtualHost 127.0.1.1:80>change the IP to "*" or to your server's IP address on the network

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question