這篇文章主要介紹了關於nginx作為odoo的反向伺服器配置,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下
nginx的安裝略。
使用web伺服器nginx作為odoo的反向代理伺服器有以下幾個優點:
1.快取網頁的靜態內容,加快網頁的載入速度。
2.利用nginx做資料分發,在分散式部署情況下能突破伺服器的效能限制。
3.如果一台伺服器有多個web服務(例如同時存在apache、odoo)都需要共用一個80端口,可以利用nginx作為反向代理伺服器根據用戶訪問的網域進行資料分發。
修改nginx.conf的設定檔。
如下
#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; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; gzip on; #开启gzip,加快oe首页的加载速度。 server { listen 80; #监听80端口 server_name 59.110.222.158; # #charset koi8-r; #access_log logs/host.access.log main; location / { proxy_pass http://59.110.222.158:8069; #反向代理服务器的ip:端口 proxy_set_header X-Real-Ip $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # 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; # } #} }
效果:
#相關推薦:
以上是nginx作為odoo的反向伺服器配置的詳細內容。更多資訊請關注PHP中文網其他相關文章!