ApacheConfigMigration
Contents
Apache Configuration
The EPrints apache configuration is distributed across a number of files. This layout changed between EPrints version 3.1 and 3.2 - this page explains the differences and advises how to migrate to the new layout after upgrading from 3.1 to 3.2+.
Apache Configuration in 3.1
cfg/ └── apache.conf var/ ├── auto-apache.conf └── auto-apache-includes.conf archives/ └── <ARCHIVEID> ├── cfg │ ├── apache.conf │ └── apachevhost.conf └── var ├── auto-apache.conf ├── auto-secure.conf └── entities.dtd
Note auto-secure.conf will only be present if using SSL
File Overview
cfg/apache.conf
- Loads files from var/
var/auto-apache-includes.conf
- Loads HTTP configuration for each repository: archives/<ARCHIVEID>/cfg/apache.conf
var/auto-apache.conf
- Global HTTP configuration
archives/<ARCHIVEID>/cfg/apache.conf
- Loads archives/<ARCHIVEID>/var/auto-apache.conf
archives/<ARCHIVEID>/var/auto-apache.conf
- VirtualHost for repository
- Loads archives/<ARCHIVEID>/cfg/apachevhost.conf
archives/<ARCHIVEID>/cfg/apachevhost.conf
- Empty - add custom directives here
archives/<ARCHIVEID>/var/auto-secure.conf
- Repository-specific SSL configuration (note no VirtualHost)
Loading into Apache
Example 1 - Debian/Ubuntu
HTTP - create a new "site" which loads the top level EPrints apache configuration file:
$ cat /etc/apache2/sites-available/eprints3 Include /opt/eprints3/cfg/apache.conf $ a2ensite eprints3
SSL - load the repository-specific EPrints apache configuration file from inside an SSL VirtualHost:
$ cat /etc/apache2/sites-available/default-ssl <IfModule mod_ssl.c> <VirtualHost _default_:443> ... Include /opt/eprints3/archives/<ARCHIVEID>/var/auto-secure.conf </VirtualHost> </IfModule> $ a2ensite default-ssl
Example 2 - RedHat/CentOS
HTTP - load top level EPrints apache configuration file:
$ tail /etc/httpd/conf/httpd.conf ... Include /opt/eprints3/cfg/apache.conf
SSL - load the repository-specific SSL configuration from inside an SSL VirtualHost:
$ cat /etc/httpd/conf.d/ssl.conf ... <VirtualHost _default:443> ... Include /opt/eprints3/archives/<ARCHIVEID>/var/auto-secure.conf </VirtualHost>
Apache Configuration in 3.1
From 3.2 onwards things were simplified - there are fewer configuration files in a single location. The configuration files are shorter as much of the processing was moved into the EPrints::Apache::Rewrite module.
cfg/ ├── apache.conf ├── apache │ └── <ARCHIVEID>.conf ├── apache_ssl.conf └── apache_ssl └── <ARCHIVEID>.conf
Note apache_ssl* files will only be present if using SSL.
File Overview
cfg/apache.conf
- Global configuration
- Loads HTTP configuration for each repository: cfg/apache/*.conf
cfg/apache/<ARCHIVEID>.conf
- VirtualHost for repository
- Loads archives/<ARCHIVEID>/cfg/apachevhost.conf if present
cfg/apache_ssl.conf
- Global SSL configuration
- Loads SSL configuration for each repository: cfg/apache_ssl/*.conf
cfg/apache_ssl/<ARCHIVEID>.conf
- Repository-specific SSL configuration (note no VirtualHost)
Loading into Apache
Example 1 - Debian/Ubuntu
HTTP - create a new "site" which loads the top level EPrints apache configuration file:
$ cat /etc/apache2/sites-available/eprints3 Include /opt/eprints3/cfg/apache.conf $ a2ensite eprints3
SSL - load the top level EPrints apache configuration file from inside an SSL VirtualHost:
$ cat /etc/apache2/sites-available/default-ssl <IfModule mod_ssl.c> <VirtualHost _default_:443> ... Include /opt/eprints3/cfg/apache_ssl.conf </VirtualHost> </IfModule> $ a2ensite default-ssl
Example 2 - RedHat/CentOS
HTTP - load top level EPrints apache configuration file:
$ tail /etc/httpd/conf/httpd.conf ... Include /opt/eprints3/cfg/apache.conf
SSL - load the repository-specific SSL configuration from inside an SSL VirtualHost:
$ cat /etc/httpd/conf.d/ssl.conf ... <VirtualHost _default:443> ... Include /opt/eprints3/cfg/apache_ssl.conf </VirtualHost>
Migrating apache configuration from 3.1 to 3.2+
This won't happen automatically when you upgrade from 3.1 to 3.2+ so follow the steps below to migrate the apache configuration after upgrading:
- Back up the 3.1 apache configuration files
- Check for any custom directives added to 3.1 apache config files, in particular cfg/apache.conf, archives/<ARCHIVEID>/cfg/apache.conf and archives/<ARCHIVEID>/cfg/apachevhost.conf
- Run bin/generate_apacheconf --system --replace - this will generate the new apache configuration files as above
- If using SSL change the top level apache SSL configuration file to load /opt/eprints3/cfg/apache_ssl.conf instead of /opt/eprints3/archives/<ARCHIVEID>/var/auto-secure.conf
- Merge custom directives back in as appropriate (noting that custom directives may be lost if generate_apacheconf is run with the --system or --replace option)
- Restart apache
- After successful testing, the following 3.1 configuration files can be removed:
var/auto-apache.conf var/auto-apache-includes.conf archives/<ARCHIVEID>/cfg/apache.conf archives/<ARCHIVEID>/var/auto-apache.conf archives/<ARCHIVEID>/var/auto-secure.conf