1.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 /usr/local/nginx/conf/mime.types; default_type application/octet-stream; #--------------------------------------------------------- charset utf-8; server_names_hash_bucket_size 128; client_header_buffer_size 2k; large_client_header_buffers 4 4k; client_max_body_size 100m; #client_max_body_size 1g; #--------------------------------------------------------- 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 /usr/local/nginx/logs/access.log main; sendfile on; #tcp_nopush on; keepalive_timeout 65; server_tokens off; #-------------------------------------------------------------------------------- gzip on; gzip_min_length 1k; gzip_buffers 4 16k; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/x-javascript text/css application/xml; gzip_vary on; #-------------------------------------------------------------------------------- include /usr/local/nginx/conf/vconf/*.conf; }
2.api.conf的内容
#server { ## http时使用该配置 # listen 80; # server_name www.xzbj.xyz; # # location / { ## root html; ## index index.html index.htm; # proxy_pass http://www.xzbj.xyzxx:8080; # } # #location = /favicon.ico { # log_not_found off; # access_log off; # } # # #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; # } #} server { listen 80; server_name www.xzbj.xyz; rewrite ^(.*)$ https://${server_name}$1 permanent; } server { listen 443; server_name localhost; ssl on; root html; index index.html index.htm; ssl_certificate /usr/local/nginx/conf/ssl/1_www.xzbj.xyz_bundle.crt; ssl_certificate_key /usr/local/nginx/conf/ssl/2_www.xzbj.xyz.key; ssl_session_timeout 5m; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; location / { #root html; #index index.html index.htm; # proxy_pass http://www.xzbj.xyzxx:8080; proxy_pass http://ali.drip; #指向upstream---进行nginx分发处理 } }
server8080.conf的内容
# 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; # } #}
upstream.conf 的内容
upstream ali.drip { #hash $remote_addr consistent; # 转发的目的地址和端口 server 118.190.146.81:9990 weight=5 max_fails=3 fail_timeout=30s; server 118.190.146.81:9991 weight=5 max_fails=3 fail_timeout=30s; }