Virtual host files (one without .conf, all others with)

I upgraded to Ubuntu 16 yesterday. As I'm checking things out, I noticed that the sites-enabled has one without .conf. I don't remember the non-.conf being there before and do not know when it showed up.
> agifforyou.com.conf -> ../sites-available/agifforyou.com.conf

benmillett.us -> ../sites-available/benmillett.us

benmillett.us.conf -> ../sites-available/benmillett.us.conf

blog.benmillett.us.conf -> ../sites-available/blog.benmillett.us

catlincurry.com.conf -> ../sites-available/catlincurry.com.conf

  • If I use a2dissite for benmillett.us, it leaves benmillett.us enabled and disables benmillett.us.conf.

  • If I change the name of sites-available/benmillett.us to sites-available/bm.us, then sites-enabled/benmillett.us shows up in red text and black highlighting and reload fails with "Job for apache2.service failed because the control process exited with error code."

I've updated benmillett.us to have the exact same text as benmillett.us.conf just to make sure that my site is serving up correctly.

Questions:

  • Should I care about benmillett.us and benmillett.us.conf both existing?

  • Do I really need benmillett.us.conf if I have benmillett.us?

  • Can I get rid of benmillett.us somehow and just rely on benmillett.us.conf?

5 Replies

Maybe it's because I'm doing things wrong or an old way but I don't use sites-enabled or sites-available. I keep my sites in conf.d.

If I were using sites-enabled I'd do like the following article suggests and keep them in a separate location and sym link them into sites-enabled/sites-available as appropriate:

https://www.linode.com/docs/websites/ap … ion-basics">https://www.linode.com/docs/websites/apache-tips-and-tricks/apache-configuration-basics

I'd also try to make sure to not have redundant configurations.

a2ensite and a2dissite look or files that end in .conf. a2dissite example.org will move example.org.conf from sites/available to sites/disabled. I am fairly sure you can change this in httpd.conf by modifying IncludeOptional sites-enabled/.conf to IncludeOptional sites-enabled/ or some such. Your mileage doing so may be variable

Thanks for the suggestions.

@jebblue I had been following this guide that suggests creating files in the sites-available folder:

https://www.linode.com/docs/websites/ho … tual-hosts">https://www.linode.com/docs/websites/hosting-a-website/#configure-name-based-virtual-hosts

For now, I've disabled the benmillett.us.conf file so that only benmillett.us is still there.

@jeremye77 I tried making that change, with no luck. Thanks though. That was good to learn about.

I can't tell from the chain, if the site(s) is/are still failing, check the Apache logs, see what's in there.

@jebblue, the site benmillett.us that had duplicate vhost files was working the whole time. I just wasn't sure about having the duplicates. After removing the .conf version, things have been working just as well as before, so I'll proceed with the single file for now.

@jebblue:

I can't tell from the chain, if the site(s) is/are still failing, check the Apache logs, see what's in there.

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