nginx.conf配置文件javascript
include main.conf; #指定nginx的進程主配置文件 http { include control.conf; # include /alidata1/app/aegis_waf_ii/conf/waf.conf; server_tag off; server_info off; server_tokens off; include vhost/*.outer; }
main.conf配置文件php
user nginx; #進程的工做用戶 worker_processes 4; #工做進程數 通常設置爲CPU個數,也能夠使用auto自動獲取 error_log /alidata1/logs/nginx/error.log; #錯誤日誌存放 events { use epoll; #指定nginx的工做模型 [請見](https://blog.51cto.com/gavin0/2125645) [epoll|rtsig|select|poll] worker_connections 20480; #指定單個進程相應的最大鏈接數 nginx服務器相應的最大鏈接數爲 worker_processes * worker_connections }
control.conf配置文件css
include mime.types; log_format UPSTREAM '$time_iso8601 $request_time $upstream_response_time $request_method $request_uri $query_string $proxy_add_x_forwarded_for $upstream_addr $status $http_user_agent $http_range;$sent_http_content_length;$body_bytes_sent $http_referer $host [$http_accept_encoding]'; log_format W3SVC '$time_iso8601 $proxy_add_x_forwarded_for $request_method $request_uri $query_string $upstream_addr [$http_user_agent] $http_referer $status'; log_format CACHE '$time_iso8601 $proxy_add_x_forwarded_for $request_method $request_uri $query_string $upstream_cache_status $status'; log_format METRICS '$msec $host $request_uri $status $upstream_addr $proxy_add_x_forwarded_for $upstream_response_time'; log_format YWEB '$time_iso8601 "$request_uri" "$request_body" "$proxy_add_x_forwarded_for" $upstream_addr $status $request_time $sent_http_content_length;$body_bytes_sent "$http_user_agent" $host'; log_format ZAWEB '$time_iso8601\t$request_uri\t$request_body\t$proxy_add_x_forwarded_for\t$upstream_addr\t$status\t$request_time\t$http_user_agent\t$host\t$request\t$http_referer\t$remote_addr\t$request_length\t$body_bytes_sent|=|$http_cookie'; open_file_cache max=1000 inactive=20s; #開發緩存的同時也指定了緩存文件的最大數量,20s若是文件沒有請求則刪除緩存 open_file_cache_valid 30s; #指多長時間檢查一次緩存的有效信息 open_file_cache_min_uses 2;#文件緩存最小的訪問次數,只有訪問超過2次的纔會被緩存 open_file_cache_errors on; #指定了當搜索一個文件時是否緩存錯誤信息,也包括再次給配置中添加文件。咱們也包括了服務器模塊,這些是在不一樣文件中定義的。若是你的服務器模塊不在這些位置,你就得修改這一行來指定正確的位置。 limit_req_zone $binary_remote_addr zone=one:20m rate=200r/s; #limit_req_zone指令進行限流訪問,防止用戶惡意×××刷爆服務器。說明:區域名稱爲one(自定義) 佔用空間大小爲20m,平均處理的請求頻率不能超出每秒200次 limit_req_log_level error;設置你所但願的日誌級別,當服務器由於頻率太高拒絕或者延遲處理請求時能夠記下相應級別的日誌。[ info | notice | warn | error] sendfile on; #優化磁盤IO設置,指定nginx是否調用sendfile函數來輸出文件,普通應用設爲on,下載等磁盤IO高的應用,可設爲off gzip_types application/javascript text/plain text/xml text/css application/x-javascript application/xml text/javascript application/x-httpd-php image/jpeg image/gif #設置須要壓縮的MIME類型,非設置值不進行壓縮 image/png; gzip_vary on; #加vary給代理服務器使用,針對有的瀏覽器支持壓縮,有個不支持,根據客戶端的HTTP頭來判斷是否須要壓縮 gzip_comp_level 9; #設置數據壓縮等級,1-9之間,9最慢壓縮比最大 client_max_body_size 100m; #此指令設置用於請求主體的緩衝區大小。 若是主體超過緩衝區大小,則完整主體或其一部分將寫入臨時文件。 若是NGINX配置爲使用文件而不是內存緩衝區,則該指令會被忽略。 默認狀況下,該指令爲32位系統設置一個8k緩衝區,爲64位系統設置一個16k緩衝區 add_header X-Frame-Options SAMEORIGIN; proxy_set_header X-Http-Scheme $scheme; proxy_next_upstream error timeout http_500 http_502 http_503 http_504;#反向代理upstream中設置的服務器組,出現故障時,被代理服務器返回的狀態值。 #error:創建鏈接或向被代理的服務器發送請求或讀取響應信息時服務器發生錯誤。 #timeout:創建鏈接,想被代理服務器發送請求或讀取響應信息時服務器發生超時。 #invalid_header:被代理服務器返回的響應頭異常。 #off:沒法將請求分發給被代理的服務器。 #http_400,....:被代理服務器返回的狀態碼爲400,500,502,等。 proxy_connect_timeout 30;#nginx服務器與被代理的服務器創建鏈接的超時時間,默認60秒 proxy_read_timeout 30;#nginx服務器想被代理服務器組發出read請求後,等待響應的超時間,默認爲60秒。 large_client_header_buffers 8 128k; proxy_buffers 8 128K; proxy_buffer_size 128K; fastcgi_buffers 8 128k ; send_timeout 60; fastcgi_next_upstream error timeout http_500 http_503; fastcgi_connect_timeout 30; fastcgi_read_timeout 50;
www.outer配置文件java
upstream dm-m.lianbooline.com { server 127.0.0.1:9080; } upstream www { server 127.0.0.1:8080; } upstream mobile { server 127.0.0.1:9080; } server { listen 80; server_name t.lianbo.com; include vhost/t.lianbo.com.inner; } server { listen 80; server_name pc.lianbo.com; include vhost/pc.lianbo.com.inner; } server { listen 443; server_name pc.lianbo.com; include vhost/https.pc.lianbo.com.inner; } server { listen 80; server_name www.lianbo.com; include vhost/www.lianbo.com.inner; } server { listen 80; server_name m.lianbo.com; include vhost/m.lianbo.com.inner; } server { listen 443 ssl http2 spdy; server_name m.lianbo.com; include vhost/https.m.lianbo.com.inner; } server { listen 80; server_name 10.156.245.63; include vhost/10.156.245.63.inner; } server { listen 80; server_name xin.lianbo.com; include vhost/xin.lianbo.com.inner; } server { listen 443 ssl http2 spdy; server_name www.lianbo.com; include vhost/https.www.lianbo.com.inner; } server { listen 80; server_name lianbo.com; include vhost/lianbo.com.inner; } server { listen 443 ssl http2 spdy; server_name lianbo.com; include vhost/https.lianbo.com.inner; } server { listen 80; server_name a.lianbo.com; rewrite ^/(.*)$ https://$host/$1 permanent; } server { listen 443 ssl http2 spdy; server_name a.lianbo.com; include vhost/https.a.lianbo.com.inner; } server { listen 80; server_name wx.lianbo.com; rewrite ^/(.*)$ https://$host/$1 permanent; } server { listen 443 ssl http2 spdy; server_name wx.lianbo.com; include vhost/https.wx.lianbo.com.inner; } server { listen 80; server_name dm-m.lianbooline.com; rewrite (.*)$ https://$host$1 permanent; #include vhost/dm-m.lianbooline.com.inner; } server { listen 443; server_name dm-m.lianbooline.com; include vhost/https.dm-m.lianbooline.com.inner; } }