Tethys Platform
Table Of Contents
Table Of Contents

NGINX Configuration

Last Updated: May 2020

NGINX is 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 NGINX configuration files.

1. Generate the NGINX Configuration

Generate the NGINX configuration file using the tethys gen command:

tethys gen nginx --overwrite

2. Review NGINX Configuration

Review the contents of the NGINX configuration file:

vim <TETHYS_HOME>/tethys_nginx.conf


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

In particular, verify the following:

  • The server_name 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 /workspace location matches the location of your TETHYS_WORKSPACES_ROOT directory.

4. Remove the Default NGINX Configuration (Ubuntu Only)

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


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

5. Note nginx User

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

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

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