問題:使用阿里雲主機和域名後,默認只能解析到ip的80端口,若是配置二級域名指向同一個ip的話是不成立的nginx
1 worker_processes 1; 2 error_log logs/error.log; 3 pid logs/nginx.pid; 4 worker_rlimit_nofile 65535; 5 events { 6 use epoll; 7 worker_connections 65535; 8 } 9 http { 10 include mime.types; 11 default_type application/octet-stream; 12 sendfile on; 13 keepalive_timeout 65; 14 client_max_body_size 50m; #緩衝區代理緩衝用戶端請求的最大字節數,能夠理解爲保存到本地再傳給用戶 15 client_body_buffer_size 256k; 16 client_header_timeout 3m; 17 client_body_timeout 3m; 18 send_timeout 3m; 19 proxy_connect_timeout 300s; #nginx跟後端服務器鏈接超時時間(代理鏈接超時) 20 proxy_read_timeout 300s; #鏈接成功後,後端服務器響應時間(代理接收超時) 21 proxy_send_timeout 300s; 22 proxy_buffer_size 64k; #設置代理服務器(nginx)保存用戶頭信息的緩衝區大小 23 proxy_buffers 4 32k; #proxy_buffers緩衝區,網頁平均在32k如下的話,這樣設置 24 proxy_busy_buffers_size 64k; #高負荷下緩衝大小(proxy_buffers*2) 25 proxy_temp_file_write_size 64k; #設定緩存文件夾大小,大於這個值,將從upstream服務器傳遞請求,而不緩衝到磁盤 26 proxy_ignore_client_abort on; #不容許代理端主動關閉鏈接 27 upstream www.kite.live { 28 server localhost:8080; 29 } 30 upstream pan.kite.live { 31 server localhost:8081; 32 } 33 34 server { 35 listen 80; 36 server_name pan.kite.live; 37 location / { 38 proxy_set_header Host $host; 39 proxy_set_header X-Real-IP $remote_addr; 40 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 41 proxy_pass http://pan.kite.live; 42 } 43 } 44 server { 45 listen 80; 46 server_name www.kite.live; 47 location / { 48 proxy_set_header Host $host; 49 proxy_set_header X-Real-IP $remote_addr; 50 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 51 proxy_pass http://www.kite.live; 52 } 53 } 54 }