I don’t know how, but I think I have accidentally managed to delete the Default Server for Apache on my VPS. This is a problem as Apache now will not start.
The exact error I get is:
Starting web server: apache2apache2: Syntax error on line 230 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/sites-enabled/000-default: No such file or directory
Action 'start' failed.
The Apache error log may have more information.
I can’t actually see anything recent in the error log (nothing later than Friday 17th).
How would I go about recreating the Default Virtual Server/make Apache work again?
Hmm, you generally don’t need that particular file.
What is on line 230 of /etc/apache2/apache2.conf?
230 is: Include sites-enabled/
And if I look in sites-enabled, there are two files. One is the one Virtual Server I currently have running. The other is 000-default. However, I get the error “No such file” if I try and open it via SFTP.
Asking ls -l suggests that it is pointing to …/sites-available/default which does not exist.
Okay… everything in sites-enabled is a link to sites-available (as you’re seeing).
So what probably happened is the file it links to in sites-available was removed.
In most cases, you don’t need that default file – that’s something that comes with Debian/Ubuntu by default, it’s not something that Virtualmin sets up.
I might suggest simply removing 000-default, which should solve the problem you’re seeing.
Thanks very much for your help. I wasn’t sure if the default server was something I did need. I’ve deleted that link, and it now functions
Slightly similar question: Is there a way to have Apache server more than one domain from the same Virtual server (eg www.domain.com and domain.com), but then have a different response for a wildcard (ie *.domain.com)?
Sure, you can add as many domains to Apache as you like. The only reason you’d need an additional IP address is if one of the domains requires an SSL certificate – you can only have one SSL cert per IP address.
Thanks for your help. So if I want more than one domain to point to the same virtual server, how would I go about doing that? (ie domain.com and anodomain.com both point to the same page)
It sounds like you may want an alias server.
To do that, click “Create Virtual Server”, and then choose the option “alias of domain.com”.
Then, you would have two domains both pointing at the same website.
Thanks very much for your help- it worked a treat!