Skip to content

Instantly share code, notes, and snippets.

@mrunkel
Created September 3, 2018 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrunkel/40f4221c6e32b85fe6d9606e5a19b81a to your computer and use it in GitHub Desktop.
Save mrunkel/40f4221c6e32b85fe6d9606e5a19b81a to your computer and use it in GitHub Desktop.
Simple HTTP to HTTPS redirect for nginx
server {
listen *:80;
server_name <SERVERNAME HERE>;
root /var/www/frontend-core/current;
index index.html index.htm index.php;
access_log /var/log/nginx/redirect-<SERVERNAME HERE>-access.log combined;
error_log /var/log/nginx/redirect-<SERVERNAME HERE>-error.log error;
rewrite ^ https://$server_name$request_uri? permanent;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment