1. 程式人生 > 資訊 >【拍 2 件】CPC 抑菌配方,黑人旗艦店 0 酒精漱口水 250mL × 2 瓶 14.9 元

【拍 2 件】CPC 抑菌配方,黑人旗艦店 0 酒精漱口水 250mL × 2 瓶 14.9 元

Nginx

nginx安裝

官網下載穩定版本,解壓後可直接啟動:windows環境

Nginx是一個反向代理,負載均衡的代理伺服器,還可以用來實現動靜分離

Nginx配置:

#執行使用者

user www-data; #啟動程序,通常設定成和cpu的數量相等 worker_processes 1; #全域性錯誤日誌及PID檔案 error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; #工作模式及連線數上限 events { use epoll; #epoll是多路複用IO(I/O Multiplexing)中的一種方式,但是僅用於linux2.6以上核心,可以大大提高nginx的效能
worker_connections 1024;#單個後臺worker process程序的最大併發連結數 # multi_accept on; } #設定http伺服器,利用它的反向代理功能提供負載均衡支援 http { #設定mime型別,型別由mime.type檔案定義 include /etc/nginx/mime.types; default_type application/octet-stream; #設定日誌格式 access_log /var/log/nginx/access.log; #sendfile 指令指定 nginx 是否呼叫 sendfile 函式(zero copy 方式)來輸出檔案,對於普通應用,
#必須設為 on,如果用來進行下載等應用磁碟IO重負載應用,可設定為 off,以平衡磁碟與網路I/O處理速度,降低系統的uptime. sendfile on; #tcp_nopush on; #連線超時時間 #keepalive_timeout 0; keepalive_timeout 65; tcp_nodelay on; #開啟gzip壓縮 gzip on; gzip_disable "MSIE [1-6]\.(?!.*SV1)"; #設定請求緩衝 client_header_buffer_size 1k; large_client_header_buffers 4 4k; include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*; #設定負載均衡的伺服器列表 upstream mysvr { #weigth引數表示權值,權值越高被分配到的機率越大 #本機上的Squid開啟3128埠 server 192.168.8.1:3128 weight=5; server 192.168.8.2:80 weight=1; server 192.168.8.3:80 weight=6; } server { #偵聽80埠 listen 80; #定義使用www.xx.com訪問 server_name www.xx.com; #設定本虛擬主機的訪問日誌 access_log logs/www.xx.com.access.log main; #預設請求 location / { root /root; #定義伺服器的預設網站根目錄位置 index index.php index.html index.htm; #定義首頁索引檔案的名稱 fastcgi_pass www.xx.com; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; include /etc/nginx/fastcgi_params; } # 定義錯誤提示頁面 error_page 500 502 503 504 /50x.html; location = /50x.html { root /root; } #靜態檔案,nginx自己處理 location ~ ^/(images|javascript|js|css|flash|media|static)/ { root /var/www/virtual/htdocs; #過期30天,靜態檔案不怎麼更新,過期可以設大一點,如果頻繁更新,則可以設定得小一點。 expires 30d; } #PHP 指令碼請求全部轉發到 FastCGI處理. 使用FastCGI預設配置. location ~ \.php$ { root /root; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /home/www/www$fastcgi_script_name; include fastcgi_params; } #設定檢視Nginx狀態的地址 location /NginxStatus { stub_status on; access_log on; auth_basic "NginxStatus"; auth_basic_user_file conf/htpasswd; } #禁止訪問 .htxxx 檔案 location ~ /\.ht { deny all; } } }