Skip to content

Instantly share code, notes, and snippets.

@ryan-blunden
Created May 13, 2019 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryan-blunden/fcadac42dd51f41f57374f6654d142f7 to your computer and use it in GitHub Desktop.
Save ryan-blunden/fcadac42dd51f41f57374f6654d142f7 to your computer and use it in GitHub Desktop.
NGINX conf for lang servers with basic auth
# This config was generated by Sourcegraph.
# You can adjust the configuration to add additional TLS or HTTP features.
# Read more at https://docs.sourcegraph.com/admin/nginx
error_log stderr;
pid /var/run/nginx.pid;
# Do not remove. The contents of sourcegraph_main.conf can change between
# versions and may include improvements to the configuration.
include nginx/sourcegraph_main.conf;
events {
}
http {
server_tokens off;
# Do not remove. The contents of sourcegraph_http.conf can change between
# versions and may include improvements to the configuration.
include nginx/sourcegraph_http.conf;
access_log off;
upstream backend {
# Do not remove. The contents of sourcegraph_backend.conf can change
# between versions and may include improvements to the configuration.
include nginx/sourcegraph_backend.conf;
}
server {
# Do not remove. The contents of sourcegraph_server.conf can change
# between versions and may include improvements to the configuration.
include nginx/sourcegraph_server.conf;
listen 7080 ssl;
ssl_certificate sourcegraph.crt;
ssl_certificate_key sourcegraph.key;
location / {
proxy_pass http://backend;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /lang-go {
proxy_pass http://lang-go:4389;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
auth_basic "Basic authentication required to access language server";
auth_basic_user_file /etc/sourcegraph/.lang_sever_htpasswd;
}
location /lang-typescript {
proxy_pass http://lang-typescript:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
location /lang-python {
proxy_pass http://lang-python:4288;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment