nginx https 禁止ip访问

@Ta 2017-09-16发布,2017-09-16修改 2641点击

https 我配置好了但是 禁止ip怎么搞?来个女装大佬帮我下

`
events {
worker_connections 1024; ## Default: 1024
}

http{
upstream * {
server 5**
24:8080;
}

# http 重定向到 https
server {
        listen 80;
    server_name ****;
    server_name_in_redirect off;
    index / index.html;

        return 301 https://$host$request_uri;
}

    # 禁止 ip 方式访问
    #server {
            # listen 443 ssl default;
           # server_name _;
           # return 500;
   # }


# https 代理 8080 端口
server {
        listen 443 ssl http2;
        listen [::]:443 ssl http2;
        ssl_certificate /etc/letsencrypt/live/*****/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/*****/privkey.pem;
        ssl_dhparam /etc/nginx/ssl/dhparam.pem;
        ssl_session_timeout 1d;
        ssl_session_cache shared:SSL:50m;
        ssl_session_tickets off;

location / {

    set $fixed_destination $http_destination;
        if ( $http_destination ~* ^https(.*)$ ) {
              set $fixed_destination http$1;
        }
    proxy_set_header Destination $fixed_destination; 
    proxy_set_header Host $host;
    #:$server_port;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header REMOTE-HOST $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass http://*****/;

      }

}

}

`

上面的配置 会导致域名也无法访问
🎖

回复列表(3|隐藏机器人聊天)
添加新回复
回复需要登录