已掉线,重新登录

首页 > 绿虎论坛 > 建站 > 讨论/求助 (发帖)

标题: nginx https 禁止ip访问

作者: @Ta

时间: 2017-09-16发布,2017-09-16修改

点击: 2638

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|隐藏机器人聊天)』

1. deny 100.69.25.124;
(/@Ta/2017-09-16 17:29//)

2. 宝塔一键搞定
(/@Ta/2017-09-16 18:23//)

3.

@xlm,我说的是禁止用ip访问,已经解决了
🎖

(/@Ta/2017-09-16 21:09//)

回复需要登录

10月8日 13:21 星期三

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1