Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # redirects www to non-www
- server {
- server_name www.subdomain.example.com;
- return 301 $scheme://subdomain.example.com$request_uri;
- }
- server {
- server_name subdomain.example.com;
- proxy_read_timeout 720s;
- proxy_connect_timeout 720s;
- proxy_send_timeout 720s;
- # Add Headers for odoo proxy mode
- proxy_set_header X-Forwarded-Host $host;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- proxy_set_header X-Real-IP $remote_addr;
- # log
- access_log /var/log/nginx/subdomain.example.com.access.log;
- error_log /var/log/nginx/subdomain.example.com.error.log;
- # Redirect longpoll requests to odoo longpolling port
- location /longpolling {
- proxy_pass http://odoochat;
- }
- # Redirect requests to odoo backend server
- location / {
- proxy_redirect off;
- proxy_pass http://odoo;
- }
- # hold static files on memory for 60 min.
- # helps relieve odoo interface a bit under heavy load
- location ~* /web/static/ {
- proxy_cache_valid 200 60m;
- proxy_buffering on;
- expires 864000;
- proxy_pass http://odoo;
- }
- # common gzip
- gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
- gzip on;
- listen 443 ssl; # managed by Certbot
- ssl_certificate /etc/letsencrypt/live/subdomain.example.com/fullchain.pem; # managed by Certbot
- ssl_certificate_key /etc/letsencrypt/live/subdomain.example.com/privkey.pem; # managed by Certbot
- include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
- ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
- }
- # redirects http to https
- server {
- if ($host = subdomain.example.com) {
- return 301 https://$host$request_uri;
- } # managed by Certbot
- listen 80;
- server_name subdomain.example.com;
- return 404; # managed by Certbot
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement