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.