Y
Y
yurygolikov2016-10-17 18:11:47
Apache HTTP Server
yurygolikov, 2016-10-17 18:11:47

Apache virtual hosts do not work. Where did I go wrong?

Why, when I go to parser.localhost and another directory is shown on test.localhost, namely the root directory of the entire web server (D:\MAMP\htdocs). At the same time, qu.ru shows everything correctly.
I'm not well versed in Apache, but I seem to have done everything according to the documentation. What could be the problem?
Thank you!

Listen 80

<VirtualHost parser.localhost:80>
    ServerAdmin [email protected]
    ServerName parser.localhost
    ServerAlias www.parser.localhost
    DocumentRoot D:/MAMP/htdocs/parser
</VirtualHost>

<VirtualHost test.localhost:80>
    ServerAdmin [email protected]
    ServerName test.localhost
    DocumentRoot D:/MAMP/htdocs
</VirtualHost>

<VirtualHost qu.ru:80>
    ServerAdmin [email protected]
    ServerName qu.ru
    ServerAlias www.qu.ru
    DocumentRoot D:/MAMP/htdocs/1_table/basic/web
</VirtualHost>

DocumentRoot "D:/MAMP/htdocs"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
CityCat4, 2016-10-17
@yurygolikov

parser.localhost and test.localhost resolve correctly?
UPD: I usually do something a little wrong. I don't know how correct this is, but it works for me :)

NameVirtualHost X.X.X.X
<VirtualHost X.X.X.X:80>
ServerName my.super.server
...другие директивы...
</VirtualHost>

At the same time, you can hang as many names as you need on the XXXX resolution - and in theory everything should work

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question