Awesome Niphlod, that works like a bomb. I really appreciate it.
On Thursday, 29 August 2013 12:36:35 UTC+2, Niphlod wrote: > > if you want the server not to work on http but only in https, then you > should have only one directive in the server block listeing to the 80 port: > server { > listen 80; > return 301 https://$host$request_uri; > } > > On Thursday, August 29, 2013 10:15:43 AM UTC+2, lbd wrote: >> >> Hi all, I recently setup a site using the nginx web2py ubuntu script. >> What I want to do is redirect all http traffic to https. In order to do >> this I tried modifying the /etc/nginx/sites-available/web2py script with a >> simple rewrite rule: >> >> server { >> listen 80; >> server_name $hostname; >> ###to enable correct use of response.static_version >> #location ~* /(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ { >> # alias /home/www-data/web2py/applications/$1/static/$2; >> # expires max; >> #} >> ### >> >> ## redirect http to https ## >> rewrite ^ https://$server_name$request_uri? permanent; >> >> >> Ironically if I type in my domain name using https://www.example.com or >> https://example.com it works perfectly. However when using http://..... >> I cannot get to the site? >> >> Please could someone advise me as to what I am missing? Is there >> somewhere else in the nginx conf that i need to configure this, or in >> web2py itself? >> >> >> -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.