B
B
BonBon Slick2017-09-18 19:46:56
Nginx
BonBon Slick, 2017-09-18 19:46:56

Your connection is not secure, how can you secure it then?

When trying to access phppgadmin.domain.com; gives a certificate error.

server {
         listen 443 ssl http2 default_server;
         listen [::]:443 ssl http2 default_server;

        root /var/www/domain/public;

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

        server_name domain.com;

        include snippets/ssl-domain.com.conf;
        include snippets/ssl-params.conf;
        location ~ /.well-known {
                allow all;
        }
         if ($scheme != "https") {
                return 301 https://$host$request_uri;
         } 

        location / {
                try_files $uri $uri/ /index.php?$query_string;
        }

     location ~ [^/]\.php(/|$) {
                include snippets/fastcgi-php.conf;
                fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
                include fastcgi_params;
        }

        location ~ /\.ht {
                deny all;
        }
}

# PhpPgAdmin
server{
        server_name     phppgadmin.domain.com;
        root            /var/www/domain/phppgadmin;
        index index.php index.html index.html

        access_log      /var/log/phppgadmin/access.log;
        error_log       /var/log/phppgadmin/error.log;

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

        location / {
                allow   18*****
                deny    all;
        }
}

I could go to PhPPgAdmin for a couple of days, now it gives an error:
Your connection is not private

Attackers might be trying to steal your information from phppgadmin.domain.com (for example, passwords, messages, or credit cards). Learn more
NET::ERR_CERT_COMMON_NAME_INVALID

--2017-09-20 10:39:01--  http://subdomain.domain.com/
Resolving subdomain.domain.com (subdomain.domain.com)... 178.62.247.93, 2a03:b0c0:2:d0::349e:1001
Connecting to subdomain.domain.com (subdomain.domain.com)|178.62.247.93|:80... connected.
HTTP request sent, awaiting response... 403 Forbidden
2017-09-20 10:39:01 ERROR 403: Forbidden.

// ping

[email protected]:/etc/nginx/sites-available$ ping subdomain.domain.com
PING subdomain.domain.com (178.62.247.93) 56(84) bytes of data.
64 bytes from 178.62.247.93 (178.62.247.93): icmp_seq=1 ttl=64 time=0.066 ms
64 bytes from 178.62.247.93 (178.62.247.93): icmp_seq=2 ttl=64 time=0.122 ms
--- subdomain.domain.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms

Link to a similar question
The error, as I understand it, is that it redirects to a subdomain with a certificate from the domain. I do not understand why then it worked for a couple of days.
Can you please tell me how to write the correct redirect then?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question