Web Server Not availible after Installing Cloudflare Certificate

I have a Site (nginx) on my Server and I recently Installed A Cloudflare Orgin Certificate On it and configured Nginx for it. Now when I try to reach the Site through a Cloudflare Proxied domain I get a 522 Error. If i try to reach it through a Not Proxied domain, I get A NET::ERR_CERT_AUTHORITY_INVALID Error In browser but I still can Acsess it by pressing Ignore. How do I solve it so I can Acsess it through Cloudflares Proxy? I checked and all Ips are allowlisted in iptables.I have the Full (strict) mode on.

My Nginx Config:

server {

        listen 443 ssl;
        ssl_certificate    /home/certs/certificate.pem;
        ssl_certificate_key    /home/certs/privatekey.key;

        root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html index.php;

        server_name _;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri =404;
        }

        # pass PHP scripts to FastCGI server
        #
        #location ~ \.php$ {
        #       include snippets/fastcgi-php.conf;
        #
        #       # With php-fpm (or other unix sockets):
        #       fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        #       # With php-cgi (or other tcp sockets):
        #       fastcgi_pass 127.0.0.1:9000;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #       deny all;
        #}
}

Oh and If I go to the Site Directly (No Subdomain) I get the SSL handshake failed error (525). I new Into Encryption and stuff so i dont know what to do Really. I installed The Certificate and I get these Errors.

Are you using the Full (strict) SSL mode in Cloudflare? This error could happen if you were using Flexible.

Yes I already Said i was

Could you try using the actual server name here (your domain)?
server_name example.com;.

That fixed the SSL handshake failed error on the domain. I still get 521s On subdomains

Are the subdomains supposed to show the same site from the same Nginx configuration?

Yea They Are Proxied to the Same Ip

And i want any Subdomain to point to the same file location: /var/www/html

Then add your subdomains to the server name directive like this:
server_name example.org www.example.org;

1 Like

Yeah Thanks!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.