Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Mar 27, 2014 6:00 am 
Offline
Junior Member

Joined: Sat Nov 10, 2012 10:24 pm
Posts: 22
I have Ubuntu 12.04 / nGinx running. Installed the SSL and all was working fine.

Now I want to force www to always be part of the URL so I currently have as the sites-available config:

#force public http to http://www
server {
listen 80;
server_name example.com;
rewrite ^(.*) http://www.example.com$1 permanent;
}


server {
listen 80;
server_name http://www.example.com;
[......]
}

#force secure https to https://www
server {
listen 443 ssl;
server_name example.com;
rewrite ^(.*) https://www.example.com$1 permanent;
}


server {
listen 443 ssl;
server_name https://www.example.com;
ssl_certificate /srv/ssl/www.example.com.crt;
ssl_certificate_key /srv/ssl/www.example.com.key;
[......]
}

But now all i get is "The connection was interrupted page".
Error logs show nothing, nginx restart produces no errors or warnings.

The SSL used www in the name during the key / crt generation.

Any ideas? Suggestions would be great.

As always thanks!

Dave


Top
   
PostPosted: Wed Apr 02, 2014 8:08 am 
Offline

Joined: Wed Apr 02, 2014 8:02 am
Posts: 1
Sorry, I dont use nGinx

Does it still use .htaccess?

If so just add this into the .htaccess file (altered accordingly)

# Redirect non-www urls to www
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.yoursite\.com
RewriteRule (.*) http://www.yoursite.com/$1 [R=301,L]


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group