odoo-nginx 配置之80端口
1 upstream odoo { 2 server 127.0.0.1:8069 weight=1 fail_timeout=0; 3 } 4 5 upstream odoo-im { 6 server 127.0.0.1:8072 weight=1 fail_timeout=0; 7 } 8 9 ## https site## 10 server { 11 listen 80; 12 server_name odoo.domain.tld; 13 root /usr/share/nginx/html; 14 index index.html index.htm; 15 16 # log files 17 access_log /var/log/nginx/odoo.domain.tld.access.log; 18 error_log /var/log/nginx/odoo.domain.tld.error.log; 19 20 # proxy buffers 21 proxy_buffers 16 64k; 22 proxy_buffer_size 128k; 23 24 ## default location ## 25 location / { 26 proxy_pass http://odoo; 27 # force timeouts if the backend dies 28 proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; 29 proxy_redirect off; 30 proxy_read_timeout 300000; 31 32 # set headers 33 proxy_set_header Host $host; 34 proxy_set_header X-Real-IP $remote_addr; 35 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 36 proxy_set_header X-Forwarded-Proto https; 37 } 38 39 # cache some static data in memory for 60mins 40 location ~* /web/static/ { 41 proxy_cache_valid 200 60m; 42 proxy_buffering on; 43 expires 864000; 44 proxy_pass http://odoo; 45 } 46 47 location /longpolling { 48 proxy_pass http://odoo-im; 49 } 50 }
操作步骤:
1. 更新服务器
sudo apt-get update -y && sudo apt-get dist-upgrade -y && apt-get auto-remove -y
2. 安装Nginx
sudo apt-get install nginx -y
3. 设置配置文件
sudo nano /etc/nginx/sites-available/YOURDOMAIN.conf
sudo ln -s /etc/nginx/sites-available/YOURDOMAIN.conf /etc/nginx/sites-enabled/YOURDOMAIN.conf
4. 重新NGINX
sudo nginx reload
service nginx restart /reload
没钱也要活的精彩