nginx配置https访问odoo

   前段日子用AppScan对odoo进行了一个漏斗扫描,发现未做ssl的odoo服务有巨大安全隐患,故需要对通过配置一个ssl来消除这些安全隐患,最终选择了通过nginx来做ssl加密

一:安装nginx

ubuntu:

apt-get install nginx

lunix:

yum install nginx
二:nginx.conf配置

安装好nginx后,使用如下配置

worker_processes 1;

events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

upstream oeserver{
server 127.0.0.1:8069;
}
server {
    listen 443 default;
    server_name _;

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

    ssl on;
    ssl_certificate     cert/cdn.openerp.hk-ca-bundle.crt; # 之前生成的证书和key
    ssl_certificate_key cert/cdn.openerp.hk.key;
    ssl_ciphers             HIGH:!ADH:!MD5;
    ssl_protocols           SSLv3 TLSv1;
    ssl_prefer_server_ciphers on;


    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_buffer_size 128k;
        proxy_buffers 16 64k;
        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-Host $host;
        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 __;
    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^/.*$ https://$host$request_uri? permanent;
}
}

注意配置好ssl路径的位置以及权限

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值