Differences in Apache VirtualHost directives between Centos7/RHEL and Debian Ubuntu
CentOSThis forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Differences in Apache VirtualHost directives between Centos7/RHEL and Debian Ubuntu
It would appear to me that setting up Virtual Hosts in Centos7 - Apache 2.4.6 - has been greatly simplified and the amount of misinformation out on the net is abundant.
I see many pages (Digital Ocean instructions for one) that are recommending force feeding the older "sites-available" "sites-enabled" setup which seems to be a more Debian approach to getting v-hosts up and running. All of the symlinks and a2ensite instructions out there for v-hosts on CentOS7 are pointless - or at least seem like trying to retrench old ideas onto a new way of doing things.
After a few hours of fiddling around with errors and failures of Apache to start due to phantom syntax errors and people all over the net suggesting a litany of SElinux problems were to blame - I just added my v-host instructions to /etc/httpd/conf.d/example-site.com.conf - then created a document root for the new v-host in /var/www/example-site.com/public_html and the virtual host resolved in seconds after an Apache restart.
It really does seem to me (either I'm crazy or everyone else is) that a lot of the "tutorials" which are out there for getting v-hosts working on Centos7/apache2.4.6 are just DEAD wrong - and will be the cause of much suffering to the noobs who are just now getting their sea legs..
Wow... What an incredible waste of time... Am I missing something here? Or am I dead on the money? None of the info I found in multiple web-tuts was even close to correct - and they all failed. What am I missing?
I would quote the tuts I'm mentioning - but didn't know about posting links here... Setting up CentOS7 Virtual Hosts is a good enough search string to find one after the other which don't really work on the LAMP packages from Centos.
I see many pages (Digital Ocean instructions for one) that are recommending force feeding the older "sites-available" "sites-enabled" setup which seems to be a more Debian approach to getting v-hosts up and running. All of the symlinks and a2ensite instructions out there for v-hosts on CentOS7 are pointless - or at least seem like trying to retrench old ideas onto a new way of doing things.
Using sites-available/sites-enabled and a2ensite is the Debian way to configure apache vhosts.
For Centos (Centos6) the default was to put the vhost config into the mail httpd.conf. In Centos7 you can use conf/conf.d/ that is include by default in apache main config file.
Quote:
Wow... What an incredible waste of time... Am I missing something here? Or am I dead on the money? None of the info I found in multiple web-tuts was even close to correct - and they all failed. What am I missing?
I would quote the tuts I'm mentioning - but didn't know about posting links here... Setting up CentOS7 Virtual Hosts is a good enough search string to find one after the other which don't really work on the LAMP packages from Centos.
Doh don't know what you've searched, but here is a couple of howtos that are using the /etc/httpd/conf.d directory: 12
Well - bless those links! Seems I only found the ones telling me to try to apply the Debian logic to CentOS 7 - which made no sense.
I've gotten things working but will pour over those pages to see if I could have done anything differently.
It's just frustrating to see things like THIS from places you'd otherwise trust not to lead you in the wrong direction.
That DO instruction does look strange to me, too. Mayhaps it's intended as a tutorial for a newbie? It certainly contains a lot of steps not needed by one supporting apache for almost 20 years.
I recently migrated to a new server and upgraded to Apache 2.4 -- I mostly struggled with the changes of "allow/deny" to "require all" syntax.
The previous installation had the VirtualHost directives in the main httpd.conf, and they work as well when added to the new (2.4) httpd.conf.
As I was migrating and converting, I just kept tweaking the default httpd.conf and adding what I needed to until the service would start with no errors and the content was delivered.
I don't think the conf/conf.d/ directory is new with CentOS 7. It existed on my CentOS 5.11 server, but only contained things I wasn't using that were set up there by default. I'm beginning to learn to use it now, but I'm a member of the "if it ain't broke don't fix it" school, so my virtual hosts will remain in the main httpd.conf.
I mostly struggled with the changes of "allow/deny" to "require all" syntax.
The previous installation had the VirtualHost directives in the main httpd.conf, and they work as well when added to the new (2.4) httpd.conf.
I've gone round and round with it because I could see that there had been a change... But without paying a ton of attention over the years it was hard to figure out exactly what. I kind of like the new process so far... And the DO post isn't going to help any noob... I just recently escaped that classification by a hair.
Only trouble I'm having is no matter what I do, which permissions or ownership I change, which document root I use, I cannot get the system to let Wordpress write files. The installs went off great. The pages serve as expected - but it simply won't allow updates, writes to files or folder creation or uploads of any kind except posts and pages written to the DB... It's a brand new, hardly fiddled with LAMP stack... So I'm cruising around trying to find which toggle needs to be switched to allow my WP installs to work as intended.
Only trouble I'm having is no matter what I do, which permissions or ownership I change, which document root I use, I cannot get the system to let Wordpress write files. The installs went off great. The pages serve as expected - but it simply won't allow updates, writes to files or folder creation or uploads of any kind except posts and pages written to the DB... It's a brand new, hardly fiddled with LAMP stack... So I'm cruising around trying to find which toggle needs to be switched to allow my WP installs to work as intended.
Yeah, that's tricky. Only just figured it out myself, I think...see this
Yeah, that's tricky. Only just figured it out myself, I think...see this
I'll certainly give it a look... Not even having a lot of luck in the error logs - looking to see who's hawking up the hairball...
Already confirmed it's not SELinux... So...
Yeah - I am responsible for kinda hijacking my own thread...
The original post was right on the money - that I was surprised how many "How To's" were telling people to apply the Debian approach to Apache on CentOS 7... Seems those posts are only going to make issues worse for people out there who cut and paste their way into trouble.
Yeah - I am responsible for kinda hijacking my own thread...
The original post was right on the money - that I was surprised how many "How To's" were telling people to apply the Debian approach to Apache on CentOS 7... Seems those posts are only going to make issues worse for people out there who cut and paste their way into trouble.
Remember Edison's quote about the light bulb?
Remain encouraged!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.