Apache Configuration

Last Updated: October 2024

Apache can be used as the primary HTTP server for a Tethys Portal deployment. It is used to handle all incoming HTTP traffic and directs it to the Daphne/Django server. It also hosts the static files needed by the apps and Tethys Portal. In this section of the production installation guide, you will generate the Apache configuration files.

Note

Skip this section if you are using NGINX as your primary HTTP server. See NGINX Configuration for NGINX configuration.

1. Generate the Apache Configuration

Generate the Apache configuration file using the tethys gen command:

tethys gen apache --overwrite

2. Review Apache Configuration

Review the contents of the Apache configuration file:

vim <TETHYS_HOME>/tethys_apache.conf

Tip

Replace <TETHYS_HOME> with the path to the Tethys home directory as noted in Portal Configuration section.

In particular, verify the following:

  • The ServerName parameter is set to your server's public domain name (e.g. my.example.com).

  • The /static location matches the location of your STATIC_ROOT directory.

  • The /media location matches the location of your MEDIA_ROOT directory.

4. Remove the Default Apache Configuration (Ubuntu Only)

For Ubuntu systems, remove the default Apache configuration file so Apache will use the Tethys configuration:

Ubuntu:

sudo rm /etc/apache/sites-enabled/default

5. Note apache User

Get the name of the apache user for use in later parts of the installation guide:

Ubuntu:

grep 'User .*' /etc/apache/apache.conf | awk '{print $2}' | awk -F';' '{print $1}'

Rocky Linux:

grep 'User .*' /etc/httpd/conf/httpd.conf | awk '{print $2}' | awk -F';' '{print $1}'

Note this user and use it in the following steps where you see <APACHE_USER>.