On 09/04/2017 16:18, Paul Stimpson
wrote:
I've just done a long-overdue refresh on my VPS. One of the
packages upgraded was Apache, to version 2.4-25. It appears the
syntax of the site conf files has changed since the last version I
was running and all is not totally "well on the farm."
I'm not an Apache wizard, but I found the following two URLs helped
me with changing my configuration for 2.4:
https://httpd.apache.org/docs/trunk/upgrading.html
https://www.digitalocean.com/community/tutorials/migrating-your-apache-configuration-from-2-2-to-2-4-syntax
The main points I had to deal with were renaming my configuration
files to end in ".conf", and replacing: "Order allow,deny
Allow from all" with "Require all granted" (or, for the opposite,
"Require all denied").
I have two IP addresses bound to the server.
I am trying to achieve:
- Running a number of different web sites on domains I own,
each with its own folder on the filesystem.
This should be the same as for 2.2.
- These websites are spread across HTTP a (80) and HTTPS (443)
on both IP addresses.
- I want Apache to recognise which site to serve from the URL,
rather than the IP address.
My 'ports.conf' has the following entries:
Listen 80
<IfModule mod_ssl.c>
Listen 443 https
</IfModule>
<IfModule mod_gnutls.c>
Listen 443 https
</IfModule>
I think I had to add the 'https' to each line that had '443' to make
it work.
For each virtual host you will probably want the entry to start:
<VirtualHost *:80> or <VirtualHost *:443> to match any
IP address (you'll need a block for each to make it work for both,
unless someone can suggest a clever way to do it all in one
virtualhost entry).
As long as your VirtualHost has a statement giving the ServerName
(and, for any alternate names, ServerAlias), this should work.
(As a side note, if you are using Certbot for your SSL certificates
you will only want one VirtualHost entry per conf file or it will
not recognise that site).
- I want separate conf files for each site to make taking them
up and down and reconfiguring easy.
This should be the same as for 2.2.
- I want to be able to serve different sites from different
folders on some subdomains e.g. example.com serves one site
and mail.example.com serves another.
Again, I don't think the syntax for this has changed in 2.4, unless
you were doing something clever (perhaps with macros?).
I hope that is of some help to you. You might need to provide a
(suitably anonymised) copy of your virtualhost setup so that we can
advise further.
Thanks
Gavin