环境Ubuntu18.04,odoo15

1、odoo安装ok,本地可以运行

2、安装nginx

     apt istall nginx

     即可,这里磨蹭了好久,主要是没有确认nginx的配置文件一直搞不定

3、申请证书不懂的参考:“https://blog.csdn.net/u012798683/article/details/113845089”,安装这个哥哥的配置搞不定

4、参考官网的模式在 /etc/nginx/sites-enabled/odoo.conf配置ok:原文链接:https://www.odoo.com/documentation/14.0/zh_CN/administration/install/deploy.html


upstream odoo {
    server 127.0.0.1:8069;
}

upstream odoochat {
    server 127.0.0.1:8072;
}

server {
    listen 80;
    listen [::]:80;
    server_name odoo16.xiaoniba.com erp6.xnb.me erp.xiaoniba.com;

    # Redirect HTTP requests to HTTPS
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name odoo16.xiaoniba.com erp6.xnb.me erp.xiaoniba.com;

    # SSL Certificate
    ssl_certificate /etc/nginx/cert/erp.xiaoniba.com/cert.pem;
    ssl_certificate_key /etc/nginx/cert/erp.xiaoniba.com/key.pem;

    # Proxy settings
    location / {
        proxy_pass http://odoo;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

    location /longpolling {
        proxy_pass http://odoochat;
    }

    # Common gzip settings
    gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
    gzip on;

    # Access and error logs
    access_log /var/log/nginx/odoo.access.log;
    error_log /var/log/nginx/odoo.error.log;
}



5、nginx -t 确认配置ok
有错误的化根据提示修改,通常是找不到文件之类的或者直接bing搜索问题
6、重启就ok,ssl链接正常,重启验证ok官网文档最强还是。


点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论
立即
投稿

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部