Skip to content

Instantly share code, notes, and snippets.

@berkant
Last active July 23, 2019 14:25
Show Gist options
  • Select an option

  • Save berkant/aa8d977d2b7f17b091af6d23fad36927 to your computer and use it in GitHub Desktop.

Select an option

Save berkant/aa8d977d2b7f17b091af6d23fad36927 to your computer and use it in GitHub Desktop.

Revisions

  1. berkant revised this gist Jul 23, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -61,6 +61,7 @@ http {
    # between versions and may include improvements to the configuration.
    include nginx/sourcegraph_server.conf;

    # Continue only if the host has src-mgmt subdomain.
    server_name src-mgmt.*;

    listen 7080;
  2. berkant revised this gist Jul 23, 2019. 1 changed file with 16 additions and 0 deletions.
    16 changes: 16 additions & 0 deletions Dockerfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    FROM sourcegraph/server:3.6.0

    # Reset original entrypoint from base image.
    ENTRYPOINT []

    # Grab tweaked nginx.conf.
    # See https://gist.github.com/0xbkt/aa8d977d2b7f17b091af6d23fad36927.
    ADD https://gist.github.com/0xbkt/aa8d977d2b7f17b091af6d23fad36927/raw/nginx.conf /etc/sourcegraph/

    # Disable self-signed SSL of Management Console.
    ENV UNSAFE_NO_HTTPS=true

    # Make Sourcegraph's frontend bind to the PORT given by Heroku at runtime.
    CMD export SRC_NGINX_HTTP_ADDR="0.0.0.0:$PORT"; \
    sed -i "s/7080/$PORT/g" /etc/sourcegraph/nginx.conf; \
    tini -s -- /usr/local/bin/server;
  3. berkant revised this gist Jul 23, 2019. 1 changed file with 18 additions and 2 deletions.
    20 changes: 18 additions & 2 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -35,6 +35,7 @@ http {
    server 127.0.0.1:2633;
    }

    # Sourcegraph Frontend
    server {
    # Do not remove. The contents of sourcegraph_server.conf can change
    # between versions and may include improvements to the configuration.
    @@ -52,12 +53,27 @@ http {
    proxy_buffers 8 256k;
    proxy_busy_buffers_size 256k;
    }
    }

    # Management Console
    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;

    location /mgmt {
    proxy_pass http://management_console/;
    server_name src-mgmt.*;

    listen 7080;
    location / {
    proxy_pass http://management_console;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    # SAML redirect response headers are sometimes large
    proxy_buffer_size 128k;
    proxy_buffers 8 256k;
    proxy_busy_buffers_size 256k;
    }
    }
    }
  4. berkant revised this gist Jul 23, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion nginx.conf
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ http {
    }

    location /mgmt {
    proxy_pass http://management_console;
    proxy_pass http://management_console/;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
  5. berkant revised this gist Jul 23, 2019. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -30,6 +30,10 @@ http {
    # between versions and may include improvements to the configuration.
    include nginx/sourcegraph_backend.conf;
    }

    upstream management_console {
    server 127.0.0.1:2633;
    }

    server {
    # Do not remove. The contents of sourcegraph_server.conf can change
    @@ -48,5 +52,12 @@ http {
    proxy_buffers 8 256k;
    proxy_busy_buffers_size 256k;
    }

    location /mgmt {
    proxy_pass http://management_console;
    proxy_set_header Host $http_host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    }
    }
    }
  6. berkant created this gist Jul 23, 2019.
    52 changes: 52 additions & 0 deletions nginx.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,52 @@
    # 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;

    # SAML redirect response headers are sometimes large
    proxy_buffer_size 128k;
    proxy_buffers 8 256k;
    proxy_busy_buffers_size 256k;

    # 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;
    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;

    # SAML redirect response headers are sometimes large
    proxy_buffer_size 128k;
    proxy_buffers 8 256k;
    proxy_busy_buffers_size 256k;
    }
    }
    }