Skip to main content

Configuring Nginx

If you followed the previous steps correctly, you should now have your own instance of Enotify up and running with a discord bot and website.

By default, the website runs on port 8000 but can otherwise be configured in the .env file. It can be served directly (with the correctly configuring DNS), or optionally you can configure Nginx as a reverse proxy in order to serve the website on port 80 and/or 443.

In this example we will be using example.com as our hostname for Enotify's website, make sure to replace this with the hostname that you will be using.

Installation

1. Install Nginx.

sudo apt update
sudo apt install nginx

2. Remove the default Nginx page.

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

3. Create a custom Nginx config.

sudo nano /etc/nginx/sites-enabled/example
/etc/nginx/sites-enabled/example
server {
server_name example.com; # replace with your own hostname

location / {
proxy_pass http://127.0.0.1:8000; # change port if you have configured it otherwise
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

4. Reload Nginx.

sudo service nginx restart
note

Make sure that you have port forwarded ports 80 and/or 443 if applicable.


Resources

To setup SSL for HTTPS, see this guide.