A
A
apaicer2019-02-18 22:53:38
Apache HTTP Server
apaicer, 2019-02-18 22:53:38

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>

After that on my ip (ifconfig) I can connect. If directly by ip, then the Apache start page, if www.xxxxxx/proba.html - displays the page that I created.
But he does not want to go to site1.ru. and I already created a guest OS and went to site1.ru !!! Then I deleted everything and wanted to do it again.
Comrades, what should be done? HELP.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2019-02-27
@SmOkE_nksp

DNS? hosts? firewall?

A
Alexey, 2019-03-05
@AlexeyVi

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 question

Ask a Question

731 491 924 answers to any question