5

i wanna learn how to have multiple sites on one server

Submitted by twovests in just_post (edited )

ah yesss $5 linode

one to set up a mastodon instance to fuck around with

another to set up a blog

another to set up a nextcloud

maybe i should have like, mastodon.mysite.xyz, blog.mysite.xyz, cloud.mysite.xyz, etc???

hmmmmm

edit: apache2 seems to be able to do this with "virtualhosts" but i mean more like

i wanna be able to say "ah yes gitlab u can have port 443"

"ah hello glances, you may as well"

"oh hello mastodon, you can also have port 80"

and have some program pluggin things and movin them around so they operate at different subdomains

man i do not understand internet at all huh

Comments

You must log in or register to comment.

3

emma wrote

The VirtualHosts stuff is what you wanna use for this. I'm pretty sure it allows you to choose which ports a site is available on.

3

bunnies wrote

I think you can configure nginx to do proxying based on the HTTP Host header. You'd have each service listen to a different port on the loopback interface, and then do something like this in the nginx config:

server {
    listen       80;
    server_name  mastodon.mysite.xyz;

    location / {
        proxy_pass   http://127.0.0.1:3000;
    }
}
server {
    listen       80;
    server_name  blog.mysite.xyz;

    location / {
        proxy_pass   http://127.0.0.1:3001;
    }
}
server {
    listen       80;
    server_name  cloud.mysite.xyz;

    location / {
        proxy_pass   http://127.0.0.1:3002;
    }
}

For https, you would have to set that up in nginx, since it needs the decrypted request in order to know where to forward it to.