[ISP3/Nginx] https only site

Discussion in 'Installation/Configuration' started by Dodge, Nov 30, 2012.

  1. Dodge

    Dodge New Member

    Hey there,

    i just installed ISP3 on my new Server(Debian6) and so far everything is running fine, but while setting up my sites, i came across a small problem.

    I want one of my sites https only. http requests should be redirected to https. https works without problems, bit i cant find a way to redirect http to https or disable http for that site at least.

    i allready tried to use the isp redirect settings for my domain with the result of an endles redirect :(
    i even tried to add a redirect block with the config option to add custom directives to nginx vhost config but that does not work as the block would be after the actual vhost block and so never matched as the block itself matches :/

    so: is there a way to disable http or redirect http -> https?

    thanks in advance
  2. webguyz

    webguyz Member HowtoForge Supporter

    Perhaps something like this in the .htaccess at the root of your website:

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://yourdomain.com/$1 [R=301,L]
  3. Dodge

    Dodge New Member

    Hey webguyz,

    thank you for your reply. but as i have written, i'm using nginx as webserver so there is no .htaccess support
  4. webguyz

    webguyz Member HowtoForge Supporter

    Oops. Keep forgetting that about nginx. Must be why I use Apache, for compatability with the rest of the world :)

    Good Luck!
  5. falko

    falko Super Moderator ISPConfig Developer

    Use this in the nginx Directives field:

    if ($scheme != "https") {
                    rewrite ^ https://$host$request_uri? permanent;
  6. Dodge

    Dodge New Member

    works perfectly. thanks! :))

Share This Page