主题
nginx反向代理配置
ubuntu中的配置
#odoo server
upstream gardenengineer.club {
server 127.0.0.1:8069;
server 127.0.0.1:8072;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
if ($host = www.gardenengineer.club) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = gardenengineer.club) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name gardenengineer.club www.gardenengineer.club;
return 404; # managed by Certbot
}
server {
listen 443 ssl;
server_name gardenengineer.club www.gardenengineer.club;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# SSL certificate configuration
ssl_certificate /etc/letsencrypt/live/gardenengineer.club/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/gardenengineer.club/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
# Redirect websocket requests to odoo gevent port
location /websocket {
proxy_pass http://gardenengineer.club;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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;
}
# Odoo proxy configuration
location / {
# Add Headers for odoo proxy mode
proxy_set_header Host $host;
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;
proxy_redirect off;
proxy_pass http://gardenengineer.club;
}
# Static file caching for improved performance (optional)
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://gardenengineer.club;
}
# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
windows中的配置
events {
worker_connections 1024; # 根据需要进行调整
}
http {
#odoo server
upstream wuliu.gardenengineer.club {
server 127.0.0.1:8069;
server 127.0.0.1:8072;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
if ($host = wuliu.gardenengineer.club) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name wuliu.gardenengineer.club;
return 404; # managed by Certbot
}
server {
listen 443 ssl;
server_name wuliu.gardenengineer.club;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# SSL certificate configuration
ssl_certificate D:/tools/nginx/ssl/wuliu.gardenengineer.club/wuliu.gardenengineer.club.pem;
ssl_certificate_key D:/tools/nginx/ssl/wuliu.gardenengineer.club/wuliu.gardenengineer.club.key;
# Redirect websocket requests to odoo gevent port
location /websocket {
proxy_pass http://wuliu.gardenengineer.club;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
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;
}
# Odoo proxy configuration
location / {
# Add Headers for odoo proxy mode
proxy_set_header Host $host;
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;
proxy_redirect off;
proxy_pass http://wuliu.gardenengineer.club;
}
# Static file caching for improved performance (optional)
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://wuliu.gardenengineer.club;
}
# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
}