sudo apt update
sudo apt upgrade
sudo apt install nginx
sudo rm /etc/nginx/sites-enabled/default
sudo rm /etc/nginx/sites-available/default
sudo nano /etc/nginx/sites-available/odoo15.conf
Step 4: Copy and paste the following configuration, ensure that you change the server_name directory to match your domain name.
upstream domain_name {
server 127.0.0.1:8069;
}
server {
listen 80;
server_name domain_name;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
client_max_body_size 100M;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Real-IP $remote_addr;
location / {
proxy_redirect http://domain_name/ https://domain_name/;
proxy_pass http://domain_name;
}
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://domain_name;
}
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
Hit Ctrl+X followed by Y and Enter to save the file and exit.
Step 5: To enable this newly created website configuration, symlink the file that you just created into the sites-enabled directory.
sudo ln -s /etc/nginx/sites-available/odoo15.conf /etc/nginx/sites-enabled/odoo15.conf
sudo nginx -t
sudo service nginx restart
Reference
- https://gist.github.com/HabiburRahman1/f4f7930b3515620ed721c3a511116779
- Second nested list item