我按照本教程http://www.schenkels.nl/2014/12/reverse-proxy-with-odoo-8-nginx-ubuntu-14-04-lts/如何使用nginx为odoo制作反向代理.
这里一切都很好.但问题在于证书.每个浏览器都发誓我的自签名证书不受信任.这是测试服务器,所以我现在并不真正关心安全性.我试图用证书和ssl禁用/评论所有内容.但是nginx仍然重定向到https,然后当它找不到证书时,它只是给出了这个错误:
Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have
Run Code Online (Sandbox Code Playgroud)
但是,如何才能忽略https,http而不使用任何加密?我需要在nginx内部调整一些东西吗?
例如,使用apache,如果没有指定使用安全连接,那么它只使用普通http,就是这样.希望其他人有更好的nginx经验.
我调整的配置看起来像这样(我只是评论了一些部分并改为重写http而不是https):
upstream odoo8 {
server 127.0.0.1:8069 weight=1 fail_timeout=0;
}
upstream odoo8-im {
server 127.0.0.1:8072 weight=1 fail_timeout=0;
}
## http redirects to https ##
server {
listen 80;
server_name _;
# Strict Transport Security
add_header Strict-Transport-Security max-age=2592000;
rewrite ^/.*$ http://$host$request_uri? permanent;
}
server {
# server port and name
listen 443;
server_name _;
# Specifies the maximum accepted body size of a client request,
# as indicated by the request header Content-Length.
client_max_body_size 200m;
# add ssl specific settings
#keepalive_timeout 60;
ssl off;
#ssl_certificate /etc/ssl/nginx/server.crt;
#ssl_certificate_key /etc/ssl/nginx/server.key;
# limit ciphers
#ssl_ciphers HIGH:!ADH:!MD5;
#ssl_protocols SSLv3 TLSv1;
#ssl_prefer_server_ciphers on;
# increase proxy buffer to handle some OpenERP web requests
proxy_buffers 16 64k;
proxy_buffer_size 128k;
#general proxy settings
# force timeouts if the backend dies
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# set headers
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
# Let the OpenERP web service know that we’re using HTTPS, otherwise
# it will generate URL using http:// and not https://
#proxy_set_header X-Forwarded-Proto https;
# by default, do not forward anything
proxy_redirect off;
proxy_buffering off;
location / {
proxy_pass http://odoo8;
}
location /longpolling {
proxy_pass http://odoo8-im;
}
# cache some static data in memory for 60mins.
# under heavy load this should relieve stress on the OpenERP web interface a bit.
location /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo8;
}
}
Run Code Online (Sandbox Code Playgroud)
您只需注释掉 80 端口上的重定向并侦听 80 端口即可。\n这可以通过配置中的以下更新来完成
\n\nupstream odoo8 {\nserver 127.0.0.1:8069 weight=1 fail_timeout=0;\n}\n\nupstream odoo8-im {\nserver 127.0.0.1:8072 weight=1 fail_timeout=0;\n}\n\n## http redirects to https ##\n#server {\n#listen 80;\n#server_name _;\n\n# Strict Transport Security\n#add_header Strict-Transport-Security max-age=2592000;\n#rewrite ^/.*$ http://$host$request_uri? permanent;\n#}\n\nserver {\n# server port and name\n# listen 443; # comment out this line\nlisten 80;\nserver_name _;\n\n# Specifies the maximum accepted body size of a client request,\n# as indicated by the request header Content-Length.\nclient_max_body_size 200m;\n\n# add ssl specific settings\n#keepalive_timeout 60;\nssl off;\n#ssl_certificate /etc/ssl/nginx/server.crt;\n#ssl_certificate_key /etc/ssl/nginx/server.key;\n\n# limit ciphers\n#ssl_ciphers HIGH:!ADH:!MD5;\n#ssl_protocols SSLv3 TLSv1;\n#ssl_prefer_server_ciphers on;\n\n# increase proxy buffer to handle some OpenERP web requests\nproxy_buffers 16 64k;\nproxy_buffer_size 128k;\n\n#general proxy settings\n# force timeouts if the backend dies\nproxy_connect_timeout 600s;\nproxy_send_timeout 600s;\nproxy_read_timeout 600s;\nproxy_next_upstream error timeout invalid_header http_500 http_502 http_503;\n\n# set headers\nproxy_set_header Host $host;\nproxy_set_header X-Real-IP $remote_addr;\nproxy_set_header X-Forward-For $proxy_add_x_forwarded_for;\n\n# Let the OpenERP web service know that we\xe2\x80\x99re using HTTPS, otherwise\n# it will generate URL using http:// and not https://\n#proxy_set_header X-Forwarded-Proto https;\n\n# by default, do not forward anything\nproxy_redirect off;\nproxy_buffering off;\n\nlocation / {\nproxy_pass http://odoo8;\n}\n\nlocation /longpolling {\nproxy_pass http://odoo8-im;\n}\n\n# cache some static data in memory for 60mins.\n# under heavy load this should relieve stress on the OpenERP web interface a bit.\nlocation /web/static/ {\nproxy_cache_valid 200 60m;\nproxy_buffering on;\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
21682 次 |
| 最近记录: |