This blog is the third post in the Sentry self-hosted series. You will set up the NGINX configuration for your Sentry self-hosted instance in this post. This post will assume you already went over the previous post that explains how to set up your custom subdomain to point to the server with Sentry self-hosted instance installed.
If you did everything correctly, your domain would still not be working as we need to tell NGINX how to redirect to the port Sentry is running on. To do so, you will need to set up the NGINX configuration.
There's an article on the DigitalOcean blog that explains this in detail. However, I will go through the needed steps to set it up.
First, you will need to ssh into the server.
The NGINX configuration directory is usually at /etc/nginx
. Inside this directory, you will see a few directories/files. We will be using 2 of these directories.
-
sites-available
: This is where we will configure the available domains. -
sites-enabled
: This is where we will configure the enabled domains.
Note: you can have many domains available but not enabled. If a domain is not enabled, it won't be publicly accessible.
We will be creating a new configuration file inside the sites-available
directory. cd
into the sites-available
directory, and you should have a default
file present in the directory. You can either copy this file into a new file using the below command:
sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/sentry.domain.com
PS: make sure to change the name of the second file from sentry.domain.com
to the domain you used in the previous article.
Or you can copy the below code and modify the content:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/sentry.domain.com;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
# this will route to port 9000
proxy_pass http://localhost:9000;
}
}
Once you're done, save the file.
Now you have your site available, but it is not enabled yet.
We can create symbolic links from the file you just created to the sites-enabled
directory, which Nginx reads from during startup.
To enable the domain, you will need to use the below command:
sudo ln -s /etc/nginx/sites-available/sentry.domain.com /etc/nginx/sites-enabled/
PS: don't forget to change the sentry.domain.com
to the one you used while setting up.
Your site is now enabled, though it won't be working just yet. There's one more step you need to do for it to work. We need to restart NGINX so that the configuration would be applied.
Restart NGINX with the below command:
sudo systemctl restart nginx
After NGINX restarts, the domain should be working.
Good luck!
Top comments (0)