Skip to content

Instantly share code, notes, and snippets.

@polaroidkidd
Created March 28, 2019 05:12
Show Gist options
  • Save polaroidkidd/fd34fd26783da043208c849f4e993c56 to your computer and use it in GitHub Desktop.
Save polaroidkidd/fd34fd26783da043208c849f4e993c56 to your computer and use it in GitHub Desktop.
nginx.conf for reverse proxy configuration for dockerized reverse nginx proxy linking bitbucket server, jira & bamboo
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
# stream {
# server {
# listen code.domain.dev:22;
# proxy_pass http://dle-bitbucket:7999;
# }
# }
# RESULT: Invalid proxy error
# upstream code.domain.dev {
# server 127.0.0.1:3000;
# }
# RESULT: Untested as of yet
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 http2;
server_name domain.dev www.domain.dev;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 http2 ssl;
server_name domain.dev www.domain.dev;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/domain.dev/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.dev/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://dle-site:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
}
}
server {
listen 443 http2 ssl;
server_name subdomain.domain.dev www.subdomain.domain.dev;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/domain.dev/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.dev/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://dle-cicd:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
}
}
server {
listen 443 http2 ssl;
server_name bitbucket.domain.dev www.bitbucket.domain.dev;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/domain.dev/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.dev/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://dle-bitbucket:7990;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
}
}
server {
listen 443 http2 ssl;
server_name jira.domain.dev www.jira.domain.dev;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/domain.dev/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.dev/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://dle-jira:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
}
}
server {
listen 443 http2 ssl;
server_name bamboo.domain.dev www.bamboo.domain.dev;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/domain.dev/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domain.dev/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://dle-bamboo:8085;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment