Nginx參數(shù)站點(diǎn)配置上的問(wèn)題解決方案
作者:佚名
Nginx參數(shù)在文件配置上有不少的問(wèn)題需要我們解決。下面我們就來(lái)詳細(xì)的看看有關(guān)nginx參數(shù)配置問(wèn)題的介紹。希望大家有所收獲。
Nginx參數(shù)有很多經(jīng)典的語(yǔ)句,其中upstream.conf 配置文件就是一個(gè)很好的例子,下面我們就看看如何才能好的使用這些語(yǔ)句呢?下面的文章就會(huì)對(duì)你有很好的幫助,尤其是在了解Nginx參數(shù)上的問(wèn)題。
- upstream.conf
- upstream bbs.linuxtone.com {
- server 192.168.1.4:8099;
- }
Nginx參數(shù)站點(diǎn)配置文件
- bbs.linuxtone.conf
- server
- {
- listen 80;
- server_name bbs.linuxtone.conf;
- charset GB2312;
- index index.html index.htm;
- root /date/wwwroot/linuxtone/;
- location ~ ^/NginxStatus/ {
- stub_status on;
- access_log off;
- }
- location / {
- root /date/wwwroot/linuxtone/;
- proxy_redirect off ;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header REMOTE-HOST $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- client_max_body_size 50m;
- client_body_buffer_size 256k;
- proxy_connect_timeout 30;
- proxy_send_timeout 30;
- proxy_read_timeout 60;
- proxy_buffer_size 256k;
- proxy_buffers 4 256k;
- proxy_busy_buffers_size 256k;
- proxy_temp_file_write_size 256k;
- proxy_next_upstream error timeout invalid_header http_500 http_503 http_404;
- proxy_max_temp_file_size 128m;
- proxy_pass http://bbs.linuxtone.com;
- }
Nginx參數(shù)都有所調(diào)整.目的是解決代理過(guò)程中出現(xiàn)的一些502 499錯(cuò)誤
- #Add expires header for static content
- location ~* \.(jpg|jpeg|gif|png|swf)$ {
- if (-f $request_filename) {
- root /date/wwwroot/linuxtone/;
- expires 1d;
- break;
- }
- }
- log_format access '$remote_addr - $remote_user [$time_local] "$request" '
- '$status $body_bytes_sent "$http_referer" '
- '"$http_user_agent" $http_x_forwarded_for';
- access_log /exp/Nginxlogs/bbs.linuxtone_access.log access;
- }
以上就是對(duì)Nginx參數(shù)的詳細(xì)介紹,希望大家有所幫助。
【編輯推薦】
- Nginx默認(rèn)虛擬主機(jī)如何在server中添加
- Nginx配置虛擬主機(jī)具體的代碼配置
- Nginx配置文件實(shí)現(xiàn)AWStats靜態(tài)頁(yè)面
- Nginx 禁止IP訪問(wèn)的代碼編寫教程
- Nginx配置文件如何驗(yàn)證是否準(zhǔn)確
責(zé)任編輯:張浩
來(lái)源:
互聯(lián)網(wǎng)