Reverse proxy (Nginx)
Installing Nginx
To install Nginx, follow the guide: How To Install Nginx on Ubuntu 20.04
Configuring Nginx
To configure Nginx, run:
sudo nano /etc/nginx/sites-available/<projectname>.conf
Edit the below code and paste it:
/etc/nginx/sites-available/<projectname>.conf
server {
listen 80;
server_name domain_or_ip;
location /media/ {
autoindex on;
alias /var/www/toddle/media/;
}
location /static/ {
autoindex on;
alias /var/www/toddle/static/;
}
location / {
include proxy_params;
proxy_pass http://0.0.0.0:8008/;
}
}
Run:
sudo ln -s /etc/nginx/sites-available/<projectname>.conf /etc/nginx/sites-enabled
sudo nginx -t
sudo systemctl restart nginx