【问题标题】:use nginx proxy odoo python server使用 nginx 代理 odoo python 服务器
【发布时间】:2018-05-11 17:41:37
【问题描述】:

我正在尝试使用 nginx 代理 odoo 服务器。我更改了 /etc/nginx/sites-available/odoo 配置文件。像这样

    upstream odoo {
    server 127.0.0.1:8069;
}

server {
    listen      443 default;
    server_name www.cheeseyun.com;

    access_log  /var/log/nginx/oddo.access.log;
    error_log   /var/log/nginx/oddo.error.log;

    ssl on;
    ssl_certificate     /etc/nginx/ssl/server.crt;
    ssl_certificate_key /etc/nginx/ssl/server.key;
    keepalive_timeout   60;

    ssl_ciphers             HIGH:!ADH:!MD5;
    ssl_protocols           SSLv3 TLSv1;
    ssl_prefer_server_ciphers on;

    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

    location / {
        proxy_pass   http://127.0.0.1:8069;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;
    }

    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering on;
        expires 864000;
        proxy_pass  http://127.0.0.1:8069;
    }
}

server {
    listen      80;
    server_name www.cheeseyun.com;

    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^/.*$ https://$host$request_uri? permanent;
}

并使用命令测试配置器,

#service nginx configtest
* Testing nginx configuration                                        [ OK ] 

用另一种方式测试

$sudo nginx -t     
nginx: the configuration file /etc/nginx/nginx.conf             syntax is ok
nginx: configuration file /etc/nginx/nginx.conf           test is successful 

但是当我使用命令 start nginx server 时,没有相关进程 start.no error.log 或 access.log 。所以我无法找出导致此问题的原因。任何人都可以帮助找出错误吗?

【问题讨论】:

    标签: python nginx proxy openerp


    【解决方案1】:

    测试成功后。重新启动服务。 代码是 - /etc/init.d/nginx restart

    【讨论】:

    • 感谢它有效!还有一个问题?为什么我使用 service nginx restart 它不起作用?它们有什么区别?
    【解决方案2】:

    启动 nginx 服务后需要配置启用。

    创建指向路径的符号链接

    /etc/nginx/sites-enable/

    sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enable/odoo

    然后,您可以再次检查您的配置

    nginx -t

    【讨论】:

    • 要做出一个很好的答案,首先解释为什么你需要这样做,不要在你的答案中提问。修正错别字。最好的:)
    猜你喜欢
    • 2016-09-29
    • 2015-09-10
    • 1970-01-01
    • 2018-09-10
    • 2012-12-18
    • 1970-01-01
    • 1970-01-01
    • 2017-08-16
    • 1970-01-01
    相关资源
    最近更新 更多