nginx 示例

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
server {
    server_name xxx.com;
    rewrite ^ https://xxx.com$request_uri? permanent;
    access_log off;
}

server {
    listen 443 ssl;
    ssl_certificate      /etc/nginx/ssl/xxx.crt;
    ssl_certificate_key  /etc/nginx/ssl/xxx.key;

    charset  utf-8;
    server_name xxx.com;
    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;
        proxy_pass   http://127.0.0.1:8080;
    }

    access_log  /home/wwwlogs/xxx-api.log main;
}