Skip to content

Instantly share code, notes, and snippets.

@maheee
Last active February 16, 2018 18:49
Show Gist options
  • Save maheee/457a3839327f21b9b5d837837dd319e4 to your computer and use it in GitHub Desktop.
Save maheee/457a3839327f21b9b5d837837dd319e4 to your computer and use it in GitHub Desktop.
nginx local dev config
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
keepalive_timeout 65;
#
# redirect to ssl pages always
#
server {
listen 80;
server_name localhost;
rewrite ^/$ https://localhost redirect;
}
#
# actual page (with ssl)
#
server {
listen 443 ssl;
server_name localhost;
#
# setup ssl
#
ssl_certificate ../_certs/nginx-selfsigned.crt;
ssl_certificate_key ../_certs/nginx-selfsigned.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
#
# disable all caching
#
if_modified_since off;
add_header Pragma no-cache;
expires -1;
#
# error pages
#
error_page 404 /404.html;
location = /404.html {
root html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
#
# actual location
#
location / {
root html/page;
index index.html index.htm;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment