#1  
Old 20th March 2013, 05:21
joey3002 joey3002 is offline
Junior Member
 
Join Date: Jan 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
Default force ssl for website

I am trying to force https for a site whenever someone goes to the http of the site.

I am running nginx, I also have ispconfig 3.0.5.1

I have tried:
return 301 https://www.mysite.com$request_uri;

however, that just goes into an endless loop

Thanks
Reply With Quote
Sponsored Links
  #2  
Old 20th March 2013, 10:24
almere almere is offline
ISPConfig Developer
 
Join Date: Nov 2012
Location: Netherlands, Rotterdam
Posts: 231
Thanks: 20
Thanked 39 Times in 34 Posts
Send a message via Skype™ to almere
Default

Try this:

Code:
server {
       listen         *:80;
       server_name    yourdomain.com;
       rewrite        ^ https://$server_name$request_uri? permanent;
}

server {

        listen *:443 ssl;
        ssl_certificate /var/www/clients/clientnumber/webnumber/ssl/yourdomain.com.crt;
        ssl_certificate_key /var/www/clients/clientnumber/webnumber/ssl/yourdomain.com.key;

### the rest of your code
}
Reply With Quote
The Following User Says Thank You to almere For This Useful Post:
joey3002 (20th March 2013)
  #3  
Old 20th March 2013, 15:46
joey3002 joey3002 is offline
Junior Member
 
Join Date: Jan 2010
Posts: 23
Thanks: 1
Thanked 0 Times in 0 Posts
Default

thanks that worked!!
Reply With Quote
  #4  
Old 18th November 2013, 21:54
pharotek pharotek is offline
Junior Member
 
Join Date: Aug 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Quote:
Originally Posted by almere View Post
Try this:

Code:
server {
       listen         *:80;
       server_name    yourdomain.com;
       rewrite        ^ https://$server_name$request_uri? permanent;
}

server {

        listen *:443 ssl;
        ssl_certificate /var/www/clients/clientnumber/webnumber/ssl/yourdomain.com.crt;
        ssl_certificate_key /var/www/clients/clientnumber/webnumber/ssl/yourdomain.com.key;

### the rest of your code
}
Hi,

The above method is almost how I'd like to achieve HTTPS over HTTP. According to NGINX, It's best practise for NGINX to use:
Code:
return 301 https://$host$request_uri;
However, using this code or the above quoted method needs separate server blocks, correct? --Otherwise you will result with infinite loops.

How does one achieve this with the sites within ISPConfig 3.0.5.3 using the directives field?

Thank you.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
haproxy with stunnel problem abubin Server Operation 6 10th April 2012 16:08
Need help with ISPConfig 3 Update midcarolina Installation/Configuration 36 8th November 2011 23:07
Adding SSL certificate to Site snowfly Installation/Configuration 2 31st May 2011 13:54
How to force SSL and TLS for a perfect installed server mgaz HOWTO-Related Questions 0 28th October 2009 22:36
SSL for virtual hosts on one certificate rbartz Tips/Tricks/Mods 8 20th November 2007 18:59


All times are GMT +2. The time now is 07:39.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.