Feng Bruce
Feng Bruce

Reputation: 13

use nginx proxy odoo python server

I am try to use nginx proxy odoo server. i changed the /etc/nginx/sites-available/odoo configure file.like this

    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;
}

and use command to test configuer,

#service nginx configtest
* Testing nginx configuration                                        [ OK ] 

use another way to test

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

but when i use command start nginx server , there is no relate process start.no error.log or access.log .so i can't find out what cause this problem.can anyone help to find out the error ?

Upvotes: 1

Views: 265

Answers (2)

Urmila Bhuva
Urmila Bhuva

Reputation: 161

After test successful. Restart the service. code is - /etc/init.d/nginx restart

Upvotes: 1

Randall C.
Randall C.

Reputation: 53

You have to make a configuration enable after start nginx service.

Create a symbolic link to path

/etc/nginx/sites-enable/

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

Then, you can check your configuration again

nginx -t

Upvotes: 1

Related Questions