概述
Nginx反向代理设置
- 配置文件
- nginx配置
- odoo 配置文件
配置文件
nginx配置
主要参见官网,直接放代码了,主要两点
- upstream odoo
- upstream odoochat
#odoo server
worker_rlimit_nofile 1024;
events {
#use epoll;
worker_connections 65563;
}
http {
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
# http -> https
server {
listen 80;
server_name odoo.antex.com;
rewrite ^(.*) https://$host$1 permanent;
}
server {
# server port and name
listen 443;
server_name odoo.antex.com;
#general proxy settings
# force timeouts if the backend dies
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
proxy_read_timeout 720s;
proxy_next_upstream error timeout invalid_header http_502 http_503;
# 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;
# proxy_set_header X-Odoo-dbfilter [odoo*];
# SSL parameters
keepalive_timeout 60;
ssl on;
ssl_certificate /etc/ssl/nginx/server.crt;
ssl_certificate_key /etc/ssl/nginx/server.key;
ssl_session_timeout 30m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;
# increase proxy buffer to handle some OpenERP web requests
proxy_buffers 16 640k;
proxy_buffer_size 1280k;
proxy_busy_buffers_size 1280k;
# log
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
# by default, do not forward anything
# proxy_redirect off;
proxy_buffering on;
# Redirect requests to odoo backend server
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
location /longpolling {
proxy_pass http://odoochat;
}
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
# common gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
# Specifies the maximum accepted body size of a client request,
# as indicated by the request header Content-Length.
client_max_body_size 1024m;
# fix 414 Request-URI Too Large
# 客户端请求头缓冲区大小,如果请求头总长度大于小于512K,则使用此缓冲区,
# 请求头总长度大于512k时使用large_client_header_buffers设置的缓存区
client_header_buffer_size 1024k;
# large_client_header_buffers 指令参数4为个数,512k为大小,默认是8k。申请4个512k。
large_client_header_buffers 10 1024k;
odoo 配置文件
主要是要设置多工作线程workers和启用代理模式proxy_mode
[options]
http_port=8069
longpolling_port=8072
#服务器
db_host=localhost
#数据库用户名
db_user=odoo12
#数据库密码
db_password=odoo12
#数据库名称
db_name = odoo14
#数据库端口,默认5432
db_port=5432
without_demo=True
#load_language=zh_CN
pg_path=/Library/PostgreSQL/10/bin
log_level = debug
#工作线程数
workers = 4
#4GB
limit_memory_soft=4294967296
limit_time_real=3000
limit_time_cpu=3000
#是否启用代理模式
proxy_mode = True
#xmlrpc_interface = 127.0.0.1
#netrpc_interface = 127.0.0.1
#http_interface = localhost
这样配置好后,就可以用https访问网页了,也启用了mail的聊天功能
最后
以上就是踏实墨镜为你收集整理的odoo中Nginx反向代理设置配置文件的全部内容,希望文章能够帮你解决odoo中Nginx反向代理设置配置文件所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复