1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

upstream web_docs {
  ip_hash;
  server 127.0.0.1:8082 weight=1 max_fails=2 fail_timeout=30s;
}
server {
    listen  443 ssl;
        server_name docs.quansuwangluo.com;
        index index.html index.htm index.php;
        ssl_certificate   cert/quansuwangluo.com.pem;
        ssl_certificate_key  cert/quansuwangluo.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;
        client_max_body_size 1024M;
        location / {
           proxy_next_upstream http_404 http_502 http_504 error timeout invalid_header;
           index index.html index.htm index.php;
           proxy_set_header Host $host;
           proxy_set_header X-Real-IP $remote_addr;
           proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
           proxy_pass      http://web_docs;
         }

    access_log  /home/wwwlogs/docs.quansuwangluo.com.log;
}

server{
    listen 80;
    server_name docs.quansuwangluo.com;
    rewrite ^(.*)$ https://$host$1 permanent;   #将所有HTTP请求通过rewrite重定向到HTTPS。
}