Odoo - Server Configuration - Steps Detail
Odoo - Server Configuration - Steps Detail
Odoo - Server Configuration - Steps Detail
1. Cài Nginx
sudo apt update
sudo apt install nginx
upstream odoowebsite {
server 127.0.0.1:8069;
}
upstream odoowebsitelong {
server 127.0.0.1:8070;
}
server {
listen 80;
server_name odoo.website;
rewrite ^/(.*)$ https://odoo.website/$1 permanent;
}
server {
include snippets/self-signed.conf;
server_name odoo.website;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
client_max_body_size 100m;
location / {
proxy_redirect off;
proxy_pass http://odoowebsite;
}
location /longpolling {
proxy_pass http://odoowebsitelong;
}
access_log /var/log/nginx/odoo_access.log;
error_log /var/log/nginx/odoo_error.log;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
location / {
add_header 'Access-Control-Allow-Origin' '*';
proxy_redirect off;
proxy_pass http://odoowebsite;
}
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoowebsite;
}
server {
ssl on;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl_prefer_server_ciphers on;
server_name odoo.website;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Protocol https;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Ssl on;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
client_max_body_size 100m;
location / {
proxy_redirect off;
proxy_pass http://odoowebsite;
}
location /longpolling {
proxy_pass http://odoowebsitelong;
}
END
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost;
#charset koi8-r;
location / {
root html;
index index.html index.htm;
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
nano /etc/nginx/sites-enabled/odoo.website
(Chèn nội dung sau vào file odoo.website vừa tạo)
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
upstream odoowebsite {
server 127.0.0.1:8069;
}
upstream odoowebsitelong {
server 127.0.0.1:8070;
}
server {
listen 80;
server_name odoo.website;
rewrite ^/(.*)$ https://odoo.website/$1 permanent;
}
server {
include snippets/self-signed.conf;
server_name odoo.website;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
client_max_body_size 100m;
location / {
proxy_redirect off;
proxy_pass http://odoowebsite;
}
location /longpolling {
proxy_pass http://odoowebsitelong;
}
- cd /home
- sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout
/usr/local/etc/ssl/private/nginx-selfsigned.key -out /usr/local/etc/ssl/certs/nginx-
selfsigned.crt
server_name odoo.website;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
ssl_dhparam /etc/ssl/certs/dhparam.pem;
################################################################
########
# from https://cipherli.st/ #
# and https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html #
################################################################
########
##################################
# END https://cipherli.st/ BLOCK #
##################################
root /usr/share/nginx/html;
location / {
proxy_redirect off;
proxy_pass http://127.0.0.1:8069;
}
location /longpolling {
proxy_pass http://127.0.0.1:8070;
}
- nginx
- Vào trình duyệt gõ https://odoo.website