Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Signed SSL not working on virtual host / server block

$
0
0
Hi,

I'm new to NGINX and am having trouble with getting signed SSL certificates to work.

Followed this tutorial in setting up:
https://www.digitalocean.com/community/tutorials/how-to-install-an-ssl-certificate-from-a-commercial-certificate-authority

Now everything works without SSL, but as soon as I change the sites-available config to allow SSL I can't get any page. In firefox I get this error:
Error code: ssl_error_rx_record_too_long

My aim is to redirect all HTTP to HTTPS. Changed my crt and key to root:root.

Here is my settings for:
sudo nano /etc/nginx/sites-available/mydomain.com.au

# Virtual Host configuration for example.com
#
# You can move that to a different file under sites-available/ and symlink that
# to sites-enabled/ to enable it.
#
server {
listen 80;
#listen [::]:80;

server_name mydomain.com.au;

rewrite ^/(.*) https://mydomain.com.au/$1 permanent;

ssl_certificate /home/user/pixelcode.com.au.chained.crt;
ssl_certificate_key /home/user/mydomain.com.au.key;

root /var/www/mydomain.com.au/public_html;
index index.html index.php;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
# include snippets/fastcgi-php.conf;
#
# # With php5-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# # With php5-fpm:
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


# Caching Control

#disable html cache
location ~* \.html$ {
expires -1;
}

location ~* \.(css|js|gif|jpeg|jpg|png|bmp|svg+xml|svg|webp|ogg)$ {
expires 3m;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}

location ~* \.pdf$ {
expires 1y;
}

}




Any help?

Thanks

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>