nginx 配置实例

user  nginx;
worker_processes  4;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;

    default_type  application/octet-stream;

    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  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;
     # aibici   web
     upstream   aibici_8000_proxy       {
          server 192.168.10.151:80 weight=1;
server 192.168.10.150:80 weight=1;
     } 
  
      
     # aibici   web_S
     upstream   aibici_4433_proxy       {
          server 192.168.10.151:443 weight=1;
server 192.168.10.150:443 weight=1; }

 include /etc/nginx/conf.d/aibici.conf;
  }




cat /etc/nginx/conf.d/aibici.conf server { client_max_body_size 20M; listen 80; server_name erp5_test.aibici.com; rewrite ^(.*)$ https://${server_name}$1 permanent; } server { client_max_body_size 20M; listen 443 ssl; server_name erp5_test.aibici.com; ssl on; ssl_certificate /etc/nginx/cert/cert-1523601212944_*.aibici.com.crt; ssl_certificate_key /etc/nginx/cert/cert-1523601212944_*.aibici.com.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 / { proxy_pass https://aibici_8000_proxy; proxy_redirect off; proxy_set_header Host $host:8000; proxy_next_upstream http_502; proxy_next_upstream_tries 3; } } server { client_max_body_size 20M; listen 8001 ssl; server_name erp5_test.aibici.com; ssl on; ssl_certificate /etc/nginx/cert/cert-1523601212944_*.aibici.com.crt; ssl_certificate_key /etc/nginx/cert/cert-1523601212944_*.aibici.com.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 / { proxy_pass https://aibici_8001_proxy; proxy_redirect off; proxy_set_header Host $host:8001; proxy_next_upstream http_502; proxy_next_upstream_tries 3; } }
原文地址:https://www.cnblogs.com/shiji888/p/10998966.html