Created
April 16, 2014 17:48
-
-
Save chrismeller/10912995 to your computer and use it in GitHub Desktop.
Nginx vhost redirect only certain URIs to ssl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
include listen_80; | |
server_name www.example.com; | |
root /home/chris/public_html/www.example.com/public; | |
access_log /home/chris/public_html/www.example.com/logs/access.log; | |
error_log /home/chris/public_html/www.example.com/logs/error.log; | |
location ~ /\.git { | |
deny all; | |
} | |
location / { | |
# force ssl for login and admin pages | |
rewrite ^/(admin|auth)(.*) https://$host$request_uri?; | |
try_files $uri $uri/ /index.php$is_args$args; | |
} | |
location ~ \.php$ { | |
fastcgi_pass php; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment