Giter VIP home page Giter VIP logo

Comments (6)

nemchik avatar nemchik commented on July 29, 2024

Completely untested, but you could try:

# make sure that your dns has a cname set for sourcegraph and that your sourcegraph container is not using a base url

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name sourcegraph.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth, fill in ldap details in ldap.conf
    #include /config/nginx/ldap.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable the next two lines for ldap auth
        #auth_request /auth;
        #error_page 401 =200 /login;

        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_sourcegraph sourcegraph;
        proxy_pass http://$upstream_sourcegraph:7080;
    }
}

from reverse-proxy-confs.

STaRDoGG avatar STaRDoGG commented on July 29, 2024

@nemchik Thanks for the help

That looks like what I had tried as well, only I also included some extra code for it's 'management console' port as well, still no luck getting it working. Here's all of the code I have so far. Note that I also included the server code for my main domain as well (in the default file in site-confs).

Code in default site-confs:

##
# Main server
# main.domain.rocks:3333
##
server {

	listen 443 ssl http2 default_server;
	listen [::]:443 ssl http2 default_server;

	root /config/www;
	index index.php index.html index.htm;

	server_name main.domain.rocks;

	include /config/nginx/proxy-confs/*.subfolder.conf;
	include /config/nginx/ssl.conf;

	client_max_body_size 0;

	location ~ \.php$ {
		fastcgi_split_path_info ^(.+\.php)(/.+)$;
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		include /etc/nginx/fastcgi_params;
	}
}

##
# Sourcegraph server
# sourcegraph.domain.rocks:3333
##
server {
	listen 443 ssl http2;
	listen [::]:443 ssl http2;

	root /config/www;
	index index.php index.html index.htm;

	server_name sourcegraph.domain.rocks;

	include /config/nginx/proxy-confs/*.subfolder.conf;
	include /config/nginx/ssl.conf;

	client_max_body_size 0;
}

Code in sourcegraph.subdomain.rocks:

server {

    listen 443 ssl;
    listen [::]:443 ssl;

    server_name sourcegraph.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    location / {

        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_sourcegraph sourcegraph;
        proxy_pass http://$upstream_sourcegraph:7080;
    }

    # This allows access to the management console
    location ~ (/sourcegraph)?/mc {
        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_sourcegraph sourcegraph;
        proxy_pass http://$upstream_sourcegraph:2633;
   }
}

Container name is sourcegraph. When I navigate to: https://sourcegraph.domain.rocks:3333 it redirects me to https://main.domain.rocks:3333.

from reverse-proxy-confs.

nemchik avatar nemchik commented on July 29, 2024

What are you doing with the port 3333?

Anyway you shouldn't need to put that stuff in the default site conf. generally speaking that file should be left alone and use what comes out of the box unless you know what you're doing.

As for the proxy conf it should be named sourcegraph.subfolder.conf and placed in the proxy conf folder. I am not familiar with how the management console works but it looks like you have it set to use a different port. Depending on how it handles subfolders/baseurl/prefix paths you may need a bit more work to get it going.

from reverse-proxy-confs.

STaRDoGG avatar STaRDoGG commented on July 29, 2024

@nemchik I use port 3333 so I can add that port to my router and have all traffic on that port go to a specific computer within my LAN. It seems to work fine. I've been doing that for years, and also have it working fine for ~16 containers so far.

Ok, I'll remove the config from the default site conf and just add the config to the proxy. I was under the impression that all subdomains needed their own server block in the default conf.

I have a sourcegraph.subdomain.conf in that folder (with that code above) because all of the sample proxy confs have either a *.subdomain.conf, and a *.subfolder.conf, and since this site in particular is a subdomain, I saved it as such; that's not correct?

Re: the different ports; sourcegraph, for whatever reason they chose, has the main "stuff" at one port, and the "management stuff" on a different port, with it's own uniquely generated, one time pw. I've never really had a chance yet to use it so I'm not sure why they chose that route rather than just include the management stuff in it's own area on the main port.

btw, the reason I'm using it as it's own subdomain rather than subfolder is because (and I found this out after quite a bit of hair loss) is that this app in particular will only work as a subdomain.

from reverse-proxy-confs.

github-actions avatar github-actions commented on July 29, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

from reverse-proxy-confs.

github-actions avatar github-actions commented on July 29, 2024

This issue is locked due to inactivity

from reverse-proxy-confs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.