Nginx config

Will

Active member
I have it pretty much all set up and stuff but need some help converting my redirects from my .htaccess file.

Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} admin.php
RewriteRule ^(.*)$ https://domain.com/$1 [R,L]
 
RewriteCond %{HTTPS} on
RewriteRule ^/?$ http://domain.com/ [R=301,L]
 
RewriteCond %{HTTP_HOST} !^domain\.com$
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

Any help would be appreciated.
 
I currently have the admin cp on https but trying to figure out a redirect back to http from the admin cp. The link posted above didn't help so I thought I'd ask to see if anyone has an idea.
 
I currently have the admin cp on https but trying to figure out a redirect back to http from the admin cp. The link posted above didn't help so I thought I'd ask to see if anyone has an idea.
Just run 2 server configs, one being SSL. On the non-SSL server, redirect traffic for location /admin.php to SSL server. On the SSL server, redirect all traffic to non-SSL server, except /admin.php location. Very simple.

Example:
https://www.axivo.com/ - redirects to http
http://www.axivo.com/community/ - redirects to https

As a side note, is useless to secure only the admin.php file. You should secure the entire forums. Nginx can cache the SSL keys for x minutes so there is no server strain. Also, I hope you use elliptic curves with Google forward secrecy enabled, for performance reasons. Read why, at the bottom of the page.
 
Just run 2 server configs, one being SSL. On the non-SSL server, redirect traffic for location /admin.php to SSL server. On the SSL server, redirect all traffic to non-SSL server, except /admin.php location. Very simple.

Example:
https://www.axivo.com/ - redirects to http
http://www.axivo.com/community/ - redirects to https

As a side note, is useless to secure only the admin.php file. You should secure the entire forums. Nginx can cache the SSL keys for x minutes so there is no server strain. Also, I hope you use elliptic curves with Google forward secrecy enabled, for performance reasons. Read why, at the bottom of the page.

Thanks for your input. At this time, I don't really want to run the entire forum on SSL.

For some reason when I tried to setup the config, SSL wouldn't work in a separate server block so I have just one. Any idea why?
 
Thanks for your input. At this time, I don't really want to run the entire forum on SSL.
Just curious, why?
For some reason when I tried to setup the config, SSL wouldn't work in a separate server block so I have just one. Any idea why?
Running SSL otherwise than how I described above is the wrong way to do it. :)
 
Just because of the type of community which is a gaming community. We have a lot of people that post external links. I would rather not go through all that. :)
Good point. You could use camo to proxy all links through your server if you can afford the bandwidth.
Well I couldn't get it to work in two separate server blocks.
Start with that:
https://www.axivo.com/community/threads/basic-nginx-configuration-file.128/
Then, read the documentation on SSL, it will work like a charm. Have fun. :)
 
Top Bottom