LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS
User Name
Password
CentOS This forum is for the discussion of CentOS Linux. Note: This forum does not have any official participation.

Notices


Reply
  Search this Thread
Old 12-26-2017, 12:51 PM   #1
mwx
Member
 
Registered: Jan 2009
Location: Virginia, USA
Distribution: CentOS - Ubuntu
Posts: 69

Rep: Reputation: 0
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.
 
Old 12-27-2017, 08:02 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,173
Blog Entries: 1

Rep: Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040Reputation: 2040
Hi,
Quote:
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:
1 2
 
Old 12-27-2017, 09:00 AM   #3
mwx
Member
 
Registered: Jan 2009
Location: Virginia, USA
Distribution: CentOS - Ubuntu
Posts: 69

Original Poster
Rep: Reputation: 0
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.
 
Old 12-27-2017, 02:16 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,748

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
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.
 
Old 12-27-2017, 02:44 PM   #5
mwx
Member
 
Registered: Jan 2009
Location: Virginia, USA
Distribution: CentOS - Ubuntu
Posts: 69

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by scasey View Post
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.
 
Old 12-27-2017, 02:59 PM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,748

Rep: Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222Reputation: 2222
Quote:
Originally Posted by mwx View Post
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
 
Old 12-27-2017, 03:16 PM   #7
mwx
Member
 
Registered: Jan 2009
Location: Virginia, USA
Distribution: CentOS - Ubuntu
Posts: 69

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by scasey View Post
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...
 
Old 12-27-2017, 04:04 PM   #8
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
and the usual location:
Code:
/usr/share/doc/apache2-*
?

Just sayin'

https://wiki.apache.org/httpd/Distro...entOS.2C_RHEL: may provide addition resources.
 
Old 12-27-2017, 04:42 PM   #9
mwx
Member
 
Registered: Jan 2009
Location: Virginia, USA
Distribution: CentOS - Ubuntu
Posts: 69

Original Poster
Rep: Reputation: 0
Talking

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.
 
Old 12-28-2017, 09:35 AM   #10
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by mwx View Post
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!
 
Old 12-28-2017, 10:02 AM   #11
mwx
Member
 
Registered: Jan 2009
Location: Virginia, USA
Distribution: CentOS - Ubuntu
Posts: 69

Original Poster
Rep: Reputation: 0
Yes - my days of blind C&P into the CLI are over... Never learn anything that way...
 
Old 12-28-2017, 02:47 PM   #12
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Resources that deserve consideration:

https://help.ubuntu.com
https://wiki.centos.org

specifically
https://wiki.centos.org/TipsAndTricks/ApacheVhostDir
https://help.ubuntu.com/lts/serverguide/httpd.html

I utilize
wiki.centos.com and help.ubuntu.com nearly every day and I have decades of experience.

G.I.G.O was the first acronym
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Apache Virtual Directives Linux_Kidd Linux - Server 5 08-02-2012 11:25 AM
Which directives are processed in which order in apache? exceed1 Linux - Server 1 05-28-2010 12:58 PM
Apache 2 Global public_html directives 0.o Linux - Server 1 10-01-2008 11:18 AM
Differences between Debian and Ubuntu jmite Linux - Distributions 5 08-03-2008 05:30 PM
Apache 1.3 configuration directives calissal Linux - Software 0 09-08-2003 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > CentOS

All times are GMT -5. The time now is 05:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration