Last active
December 6, 2020 13:41
-
-
Save ianjuma/9009490 to your computer and use it in GitHub Desktop.
Nginx subdomain sample config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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