Skip to content

Instantly share code, notes, and snippets.

@Pierozi
Created March 12, 2018 10:05
Show Gist options
  • Save Pierozi/4923df131e60acdb6bfedce89ad6064a to your computer and use it in GitHub Desktop.
Save Pierozi/4923df131e60acdb6bfedce89ad6064a to your computer and use it in GitHub Desktop.
Nginx configuration for HTTPS redirection
user www-data;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
multi_accept on;
}
http {
server_tokens off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log off;
error_log off;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-available/*;
open_file_cache max=100;
server {
server_name _;
listen [::]:80;
listen 80;
ssl off;
add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
rewrite ^/.*$ https://$host$request_uri? permanent;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment