перенаправление nginx, хотя такого файла нет - PullRequest
0 голосов
/ 15 февраля 2019

Я использую nginx с cerbot на цифровом океане.Я новичок в nginx.У меня только один файл на сайтах включен.Этот файл имеет следующее содержание: Теперь, когда я отправляю запрос на albahriacssacademy.com, я получаю перенаправление на другой домен, который я использовал ранее.

Я знаю, что это может быть не связано, но я удалил все сертификаты и обновил их.Пожалуйста, смотрите ответ скручивания ниже также.Что здесь происходит и как этого избежать.

server {
    root /var/www/html/;

    index index.php index.html index.htm index.nginx-debian.html;

    server_name albahriacssacademy.com www.albahriacssacademy.com;

    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
            root /usr/share/nginx/html;
        }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
    }


    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/albahriacssacademy.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/albahriacssacademy.com/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}



server {
    if ($host = www.albahriacssacademy.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    if ($host = albahriacssacademy.com) {
        return 301 https://$host$request_uri;
    } # managed by Certbot



    server_name albahriacssacademy.com www.albahriacssacademy.com;
    listen 80;
    return 404; # managed by Certbot
}

но я получаю следующий ответ

curl -L albahriacssacademy.com -v
* Rebuilt URL to: albahriacssacademy.com/
*   Trying 206.189.36.41...
* Connected to albahriacssacademy.com (206.189.36.41) port 80 (#0)
> GET / HTTP/1.1
> Host: albahriacssacademy.com
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.10.3 (Ubuntu)
< Date: Thu, 14 Feb 2019 21:41:14 GMT
< Content-Type: text/html
< Content-Length: 194
< Connection: keep-alive
< Location: https://albahriacssacademy.com/
< 
* Ignoring the response-body
* Connection #0 to host albahriacssacademy.com left intact
* Issue another request to this URL: 'https://albahriacssacademy.com/'
* Found bundle for host albahriacssacademy.com: 0x5556830c0330 [can pipeline]
*   Trying 206.189.36.41...
* Connected to albahriacssacademy.com (206.189.36.41) port 443 (#1)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 594 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
*    server certificate verification OK
*    server certificate status verification SKIPPED
*    common name: albahriacssacademy.com (matched)
*    server certificate expiration date OK
*    server certificate activation date OK
*    certificate public key: RSA
*    certificate version: #3
*    subject: CN=albahriacssacademy.com
*    start date: Thu, 14 Feb 2019 20:40:22 GMT
*    expire date: Wed, 15 May 2019 20:40:22 GMT
*    issuer: C=US,O=Let's Encrypt,CN=Let's Encrypt Authority X3
*    compression: NULL
* ALPN, server accepted to use http/1.1
> GET / HTTP/1.1
> Host: albahriacssacademy.com
> User-Agent: curl/7.47.0
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Server: nginx/1.10.3 (Ubuntu)
< Date: Thu, 14 Feb 2019 21:41:14 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Location: https://albahriainstitute.com/
< 
* Ignoring the response-body
* Connection #1 to host albahriacssacademy.com left intact
* Issue another request to this URL: 'https://albahriainstitute.com/'
*   Trying 206.189.36.41...
* Connected to albahriainstitute.com (206.189.36.41) port 443 (#2)
* found 148 certificates in /etc/ssl/certs/ca-certificates.crt
* found 594 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* SSL connection using TLS1.2 / ECDHE_RSA_AES_128_GCM_SHA256
*    server certificate verification OK
*    server certificate status verification SKIPPED
* SSL: certificate subject name (albahriacssacademy.com) does not match target host name 'albahriainstitute.com'
* Closing connection 2
curl: (51) SSL: certificate subject name (albahriacssacademy.com) does not match target host name 'albahriainstitute.com'
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...