Skip to content

Instantly share code, notes, and snippets.

@ittp
Forked from ianjuma/nginx subdomains config
Created June 15, 2020 03:54
Show Gist options
  • Save ittp/6ad1825d762cf2e13f13e2aa68b7c51e to your computer and use it in GitHub Desktop.
Save ittp/6ad1825d762cf2e13f13e2aa68b7c51e to your computer and use it in GitHub Desktop.
Nginx subdomain sample config
worker_processes 5;
error_log /var/log/nginx/error.log;
pid /var/log/nginx/nginx.pid;
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
use epoll;
}
http {
include conf/mime.types;
include /etc/nginx/proxy.conf;
include /etc/nginx/fastcgi.conf;
index index.html;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $status '
'"$request" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
server_names_hash_bucket_size 128; # this seems to be required for some vhosts
server {
listen 80;
server_name www.benchcare.co;
access_log /var/log/nginx/access.log main;
root html;
location / {
proxy_pass http://127.0.0.1:5000;
}
}
server {
server_name www.benchcare.co;
location / {
proxy_pass http://127.0.0.1:5000;
}
location /app {
uwsgi_pass http://127.0.0.1:3031;
# You can also use sockets such as : uwsgi_pass unix:/tmp/uwsgi.sock;
include uwsgi_params;
}
}
server {
listen 80;
server_name docs.benchcare.co;
location / {
proxy_pass http://127.0.0.1:5000/docs;
}
}
# reverse proxy
upstream backend {
server http://127.0.0.1:5000 weight=5; # gevent
server http://127.0.0.1:5001 weight=5; # uwsgi
server http://127.0.0.1:5002; # gunicorn + gevent
server http://127.0.0.1:5003; # gevent + gunicorn
}
/*
upstream uwsgi_host {
server http://127.0.0.1:5001;
}
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment