Skip to content

Instantly share code, notes, and snippets.

@codedmart
Created March 9, 2016 06:38
Show Gist options
  • Save codedmart/7182a10da31fcaa5143c to your computer and use it in GitHub Desktop.
Save codedmart/7182a10da31fcaa5143c to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name api.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name api.domain.com;
ssl on;
ssl_certificate /etc/nginx/ssl/cert/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/key/key.key;
location / {
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:8001/;
proxy_redirect off;
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name sockets.domain.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name sockets.domain.com;
ssl on;
ssl_certificate /etc/nginx/ssl/cert/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/key/key.key;
location / {
proxy_pass http://127.0.0.1:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_read_timeout 86400;
}
}
user www-data;
worker_processes 4;
pid /run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;
client_max_body_size 4m;
server_names_hash_bucket_size 64;
# server_name_in_redirect off;
# Fastcgi
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
# Proxy
proxy_buffer_size 128k;
proxy_buffers 8 256k;
proxy_busy_buffers_size 256k;
# Header configs
client_header_buffer_size 32k;
large_client_header_buffers 8 32k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment