You are not logged in.

#1 2014-07-25 09:29:40

luken
Member
Registered: 2014-06-26
Posts: 37

Virtual hosts work only after I will restart a httpd

This is strange. I'm using Apache server, and have problem with virtual hosts. For example I have a host:

<VirtualHost myhost.localhost:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot "/srv/http/projects/2014/myhost.pl/public_html"
    ServerName myhost.localhost
    ServerAlias www.myhost.localhost
    ErrorLog "/var/log/httpd/myhost.localhost-error_log"
    CustomLog "/var/log/httpd/myhost.localhost-access_log" common
    <Directory "/srv/http/projects/2014/myhost.pl/public_html">
        AllowOverride All
        Options Indexes FollowSymLinks
        Require all granted
    </Directory>
</VirtualHost>

I also added a

127.0.0.1   myhost.localhost

line to /etc/hosts file.

Now when I restart my computer myhost.localhost will show me default "It works!" message, and just after "sudo systemctl restart httpd" the proper website will appear under this address. Why is that?

Offline

#2 2014-07-25 11:59:57

Spider.007
Member
Registered: 2004-06-20
Posts: 1,175

Re: Virtual hosts work only after I will restart a httpd

Not sure what your actual hostname is; but this is probably related to DNS not being available at boot. Depending on your actual name; apache might listen on the wrong interface / source-address for this domain; which is only fixed by restarting it when you have a working dns-server.

Offline

#3 2015-04-29 09:28:46

noun
Member
Registered: 2015-04-29
Posts: 1

Re: Virtual hosts work only after I will restart a httpd

Offline

Board footer

Powered by FluxBB