ssl golang nginx 配置问题

upstream test {
    ip_hash; 
    server 127.0.0.1:8001; 
    ...
}

server {
    listen 443 ssl;
    listen [::]:443 ssl ipv6only=on;
    ssl    on;

    ssl_certificate /etc/letsencrypt/live/test.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/test.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/test.com/chain.pem;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

    server_name test.com www.test.com;
    location / {
        proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
        proxy_set_header X-Forwarded-Port $http_x_forwarded_port;
        proxy_set_header X-Forwarded-For $http_x_forwarded_for;
        proxy_pass_header Server;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Scheme $scheme;
        proxy_pass http://test;
    }
    location /static {
        root /var/go/src/test;
        expires 1d;
        add_header Cache-Control public;
        access_log off;
    }
}

server {
    listen      80;
    server_name test.com www.test.com; 
    return 301 https://$host$request_uri;

    #return 301 https://$http_host$request_uri;
    #return 301 https://$server_name$request_uri; 

    location / {
        root   /usr/share/nginx/test;
        index  index.html index.htm;
    } 

} 

请问以上这样的配置为啥不行呢?在哪里需要改进?

共 2 个回复


gomgo

睡一觉就好了!

昨晚就是不行!

基本没啥事的!

唉!打扰大家乐了

# 0

gomgo

请站长把这个问题删除吧

# 1