Answer the question
In order to leave comments, you need to log in
Why is it not possible to access a site on apache by domain, but only by ip (Centos 6)?
Good evening. I'm setting up an apache server on centos 6. I can't understand why I can access my site only by ip, but I can't by domain. More precisely, I created guest OSes in VB and somehow it turned out that both by ip and by domain go to one site.
yum -y install httpd php - starter kit to get things working
nano /etc/httpd/conf/httpd.conf - uncommented
NameVirtualHost *:80
<VirtualHost *:80>
# ServerAdmin webmaste
DocumentRoot /var/www/boss/site1 - здесь лежит файл proba.html
ServerName www.site1.ru
ServerAlias site1.ru
</VirtualHost>
Answer the question
In order to leave comments, you need to log in
Do you understand that virtual host does not work by IP?
Let's try to put the mess in our heads:
When you register several virtual hosts on 1 IP, then in your HTTP header it is transmitted who the client is contacting, respectively, the server issues the Vitrual Host that matches the request.
Your problem is most likely the absence of a DNS name for your site.
Try a knight's move: on the client machine, in the hosts file, write statically the mapping
ip site1.ru
Thus, the name of the virtual host will be transferred to the server in the header
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question