Как пролечить, чтобы редиректило на основной сайт когда в браузере вбиваешь айпи сервера?
Сейчас оно так:


Код: Выделить всё
server {
    listen 80;
    listen [::]:80;
    server_name  default ;
    root  /var/www/html;
    access_log /etc/nginx/vhost_logs/!!default_access;
    error_log /etc/nginx/vhost_logs/!!default_error;
    location ~ /.well-known { allow all; }
    # location ~* robots.txt  { root /etc/nginx; }
    location ~ /\.ht {
        deny all;
        access_log off;
        log_not_found off;
    }
    location / {
        root /var/www/html;
        index index.php index.html index.htm;
        if (!-e $request_filename) {
            rewrite ^(.+)$ /index.php?q=$1 last;
        }
    }
    # error_page  404              /404.html;
    # location = /40x.html {
    # }
    # error_page   500 502 503 504  /50x.html;
    # location = /50x.html {
    # }
}Код: Выделить всё
server {
    listen ***:80;
    listen [***]:80;
    server_name ***.com;
}
server {
    listen ***:80;
    listen [***]:80;
    server_name www.***.com;
    return 301 $scheme://***.com$request_uri;
}Код: Выделить всё
# For SSL Compatibility - WP Super Cache and WP Rocket depend on this
map $scheme $https_suffix { default ''; https '-https'; }
server {
    listen ***:443 ssl http2;
    listen [***]:443 ssl http2;
    server_name ***.com;
    root /home/username/sites/***.com;
    index index.php;
    ssl_certificate /etc/certs/username/***.com_1578429318.crt_v2;
    ssl_certificate_key /etc/certs/username/***.com_1578429318.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:ECDHE:!COMPLEMENTOFDEFAULT;
    ssl_prefer_server_ciphers on;
    add_header Strict-Transport-Security "max-age=31536000";
    access_log off;
    error_log /etc/nginx/vhost_logs/***.com_error;
    pagespeed on;
    pagespeed DisableFilters rewrite_images;
    pagespeed FileCachePath /var/cache/ngx_pagespeed_cache;
    pagespeed MemcachedServers "127.0.0.1:11211";
    pagespeed XHeaderValue "Powered By ngx_pagespeed";
    pagespeed BlockingRewriteKey "fullyoptimized";
    pagespeed Disallow "*/wp-admin/*";
    pagespeed Disallow "*/wp-login.php*";
    set $skip_cache 0;
    # POST requests and urls with a query string should always go to PHP
    if ($request_method = POST) {
            set $skip_cache 1;
    }
    if ($query_string != "") {
            set $skip_cache 1;
    }
    if ( $cookie_woocommerce_items_in_cart = "1" ){
            set $skip_cache 1;
    }
    # Don't cache URIs containing the following segments
    if ($request_uri ~* "/wp-admin/|wp-.*.php|/feed/|index.php|sitemap(_index)?.xml") {
             set $skip_cache 1;
    }
    if ($request_uri ~* "/(cart|checkout|my-account)/*$") {
            set $skip_cache 1;
    }
    # Don't use the cache for logged-in users or recent commenters
    if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp-postpass|wordpress_no_cache|wordpress_logged_in") {
            set $skip_cache 1;
    }
    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
    location ~ \.php$ {
        #NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        include fastcgi.conf;
        fastcgi_intercept_errors on;
        fastcgi_pass php-fpm;
        fastcgi_cache microcache;
        fastcgi_cache_key $scheme$host$request_uri$request_method;
        fastcgi_cache_valid 60m;
        fastcgi_cache_use_stale updating error timeout invalid_header http_500;
        fastcgi_cache_bypass $skip_cache;
        fastcgi_no_cache $skip_cache;
        fastcgi_pass_header Set-Cookie;
        fastcgi_pass_header Cookie;
        fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
        add_header X-Cache $upstream_cache_status;
    }
    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
        expires max;
        log_not_found off;
    }
    include /home/username/sites/***.com/*.conf;
}
server {
    listen ***:443 ssl http2;
    listen [***]:443 ssl http2;
    server_name www.***.com;
    ssl_certificate /etc/certs/username/***.com_1578429318.crt_v2;
    ssl_certificate_key /etc/certs/username/***.com_1578429318.key;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers TLS13-CHACHA20-POLY1305-SHA256:TLS13-AES-128-GCM-SHA256:TLS13-AES-256-GCM-SHA384:ECDHE:!COMPLEMENTOFDEFAULT;
    ssl_prefer_server_ciphers on;
    return 301 $scheme://***.com$request_uri;
}Тоже, что и все остальные. Например для brainycp.com это будет server1702.shneider-host.ru