1. 程式人生 > >Ubuntu14.04下Nginx反向代理Odoo域名

Ubuntu14.04下Nginx反向代理Odoo域名

安裝nginx

sudo apt-get install -y nginx

  

修改配置檔案

vi /etc/nginx/nginx.conf
#註釋掉下面這行程式碼
#include /etc/nginx/sites-enabled/*;
#儲存

  

/etc/nginx/conf.d目錄下新建一個配置檔案

vi /etc/nginx/conf.d/www.example.com.conf
#加入下面的程式碼
server {
    listen 80;
    server_name www.example.com;
    
    location / {
        proxy_pass http://localhost:8069;
        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Real-IP $remote_addr;
    }
}
#儲存
service nginx restart  #重啟nginx服務

  

在瀏覽器中開啟www.example.com便可訪問到odoo了。



作者:itrojan
連結:https://www.jianshu.com/p/ea5ccd5ba3ea