Hello all,
I have a week off work and wanted to dive into Apache 2.4 installation and management full speed. I have read up on, and installed, httpd a few times already successfully. Getting httpd running, Selinux happy, and firewalld configured is not a problem. Dropping a website template into place and tweaking it is also not a problem. Now, I want to blow it all away and start from scratch with a purposeful install instead of mindlessly following a few guides that leave me with a working but relatively uninformed setup.
Environment:
CentOS7 minimal installation for httpd servers
Firewall device is a pfSense install, routing and forwarding is fine
Separate subnets and VLANs for some of the web servers
Needs (based on the articles I have read):
several domains point to my external IP address (using dynamic dns) - done
Apache virtual hosts file to handle different domains from one host
Apache reverse proxy settings to point some domains to other hosts in my network
Expected layout: (not complete)
Three domains point to my IP address. External ports 80 & 443 are forwarded to a VM handling httpd. domain1 has an entry in a virtual hosts file, domain2 has an entry of its own in the same file, and domain3 points to another VM. Part of this reasoning is that domain3 is hosting a web service that I don't want running on the primary VM, and I also want an excuse to get the apache proxy into place. This is 50% learning/ 50% useful in my home environment.
Questions:
Default file locations: Cent7 has a way of doing things, and I see references in guides to using /srv, some say /var/www, some say /opt... is there a defensible reason to use any location for hosting web server files in a particular location? I'm glad to do what is typical for a Cent type install, but I also understand that I can make this work from any location I choose.
Overview to
How. Apache. Works. I have been a little overwhelmed reading articles and other questions and answers about httpd best practices, and I think I could use a 101 level breakdown of the components of Apache configuration. The LAMP stack itself is not the problem, since the scripting and db aspects are easy enough to install and tweak (so far). I would really appreciate if someone would write a quick blurb along these lines:
1 - Apache configuration files themselvces go under /etc/httpd/*
2 - Individual website files (vhosts etc.) go under /var/www/$vhost
3 - Vhost settings and configurations are under the same file?
4 - Are there any key file locations that I'm missing?
https://httpd.apache.org/docs/2.4/vhosts/examples.html has been very useful for me to start to see configuration syntax for hosting multiple sites as I'm trying to do, but I'm not quite sure what steps to take in order. Install httpd, declare site names and proxy addresses, and then host web files in the locations that I choose? I'm not even sure which settings go in which files.
Bonus points: I see lots of documentation on password files, locking directories, and avoiding exposing the indices of my sites, but I would imagine those steps come afterwards (or ideally simultaneously during creation)? No sites are publicly exposed yet, so installing the files and leaving them less secured up front is fine by me. The hosts are single-purpose and very locked down on their own networks so no one can browse to them, and there are no other services on those subnets/VLANs.
Thank you all in advance!