Jaydeep Chaudhari
Jaydeep Chaudhari

Reputation: 430

When enable SSL on Nginx page redirects to default page

I have a nginx server which is running multiple vhost, I have configured one more vhost and tried to make it https, but when I tried to access it redirects to default page. I have configured SSL certs with letsencrypt.

my config file is

 server {
    listen 443 ssl;

    root /var/www/html;

    server_name abc.xyz.com;
    include includes/letsencrypt;

    location / {
        proxy_pass http://abc;
        include includes/proxy-config;
    }
}

I have also tried with below config

 server {
  listen 80;
  server_name abc.xyz.com;
  return 301 https://abc.xyz.com$request_uri;
 }


server {
    listen 443 ssl;
    server_name abc.xyz.com;
    ssl on;
    include includes/letsencrypt;

    access_log  /var/log/nginx/log/abc.access.log;
    error_log   /var/log/nginx/log/abc.error.log;

location /.well-known/acme-challenge {
    root /var/www/letsencrypt;
 }

    location / {
        proxy_pass http://abc;
    }
}

After this page is redirecting to my firewall. Port 443 is also opened up.

Any Ideas what is wrong here?

Upvotes: 0

Views: 454

Answers (2)

Mike Rouse
Mike Rouse

Reputation: 1298

I too had this problem, but for me the solution was eventually found in a problem with the configuration file for php-fpm. There was a problem creating/accessing the error log for php-fpm, which I had turned on myself in the config file for php-fpm earlier thinking it was a good thing to do. Turning it back off again, restarting php-fpm and nginx got everything working as expected.

Just in case you're googling around like I was and kept finding this question at the top ;-)

Upvotes: 0

Jaydeep Chaudhari
Jaydeep Chaudhari

Reputation: 430

I have nail down this by adding NAT rule in firewall. Basically nothing wrong in above configuration. I had only opened port on firewall.

As opening port is just between Internet and firewall NAT redirects traffic from public-ip:443 -> local-ip:443

Upvotes: 1

Related Questions