Nginx Reverse proxy odoo and switch to HTTPS

Source: Internet
Author: User
Tags nginx reverse proxy
Generate a certificate file

Generate a self-signed certificate and place it in the specified location

3650'/CN=odoo.youyun.com/' -nodes -newkey rsa:2048sudosudo mv server.key server.crt /etc/ssl/nginx

Configure Nginx

sudosudo vim /etc/nginx/sites-avalibale/odoo.conf

Delete the default Nginx defaults file and create a new odoo.conf file with the following contents

Server{Listen443Defaultserver_name_;Access_log/var/log/nginx/odoo.access.log;Error_log/var/log/nginx/odoo.Error. log;SSL on;ssl_certificate/ETC/SSL/NGINX/SERVER.CRT;# previously generated certificate and keySsl_certificate_key/etc/ssl/nginx/server.key;ssl_ciphershigh:! Adh:! MD5;Ssl_protocolsSSLv3 TLSv1;ssl_prefer_server_ciphers on; Location/ {Proxy_passhttp://127.0.0.1:8069;Proxy_next_upstreamErrorTimeout Invalid_header http_500 http_502 http_503 http_504;proxy_buffer_size128k;proxy_buffers -64k;Proxy_redirectif;Proxy_set_headerHost$host;Proxy_set_headerX-real-ip$remote _addr;Proxy_set_headerX-forwarded-for$proxy _add_x_forwarded_for;Proxy_set_headerX-forwarded-proto HTTPS; } Location~*/web/static/{Proxy_cache_valid $60m;proxy_buffering on;Expires864000;Proxy_passhttp://127.0.0.1:8069; }}Server{# Turn 80 ports to 443 HTTPSListen the;server_name__;Add_headerStrict-transport-security max-age=2592000;rewrite ^/.*$https://$host $request_uri?Permanent;}Server{# 8069 Port of a specific IP to 443 HTTPSListen192.168.1.102:8069;# This is the IP of the virtual machineserver_name__;Add_headerStrict-transport-security max-age=2592000;rewrite ^/.*$https://$host $request_uri?Permanent;}

Configure Access Source Host

    • SERVER.CRT Certificate generated prior to installation
    • Modify the Hosts file to add because the domain name was used by the previous certificate

      192.168.1.102 odoo.youyun.com

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the Nginx reverse proxy odoo and to HTTPS, including aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.