Apache virtualhost setting always fail after reboot

Just setup an apache webserver with the following virtualhost:

 <virtualhost 123.45.67.89:80="">ServerAdmin admin@mysite.com
    ServerName mysite.com
    ServerAlias www.mysite.com
    DocumentRoot /srv/www/mysite.com/public_html
    ErrorLog /srv/www/mysite.com/logs/error.log
    CustomLog /srv/www/mysite.com/logs/access.log combined</virtualhost> 

And the I disabled the default virtualhost and enable mine:

a2dissite default

a2ensite mysite.com

Reload:

/etc/init.d/apache2 reload

My /etc/hosts is as follow:

127.0.0.1   localhost.localdomain   localhost
123.45.67.89   myhost.mysite.com   myhost

And then I tested by accessing http://mysite.com and http://www.mysite.com, everything works fine.

The problem is, everytime I reboot my box, I can no longer access my site anymore.

Doesn't work with http://mysite.com and http://www.mysite.com.

The only way I can make it work again is by issuing /etc/init.d/apache2 reload everytime after rebooting.

This happens all time time everytime I reboot (tried it multiple times in the past 2 days).

Any suggestions?

Thanks in advance.

1 Reply

Did some fiddling around. It seems that after reboot, apache always look for files in (according the the log):

/etc/apache2/htdocs

Which is incorrect since the document root is specified somewhere else.

I tried enabling the 'default' virtual host but it didn't seem to help.

I search everywhere in case there is a config file somewhere using /etc/apache2/htdocs. Nothing found.

Anyone?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct