Is it possible to specify what URL the app will run in?

Hello,

I want to add some apps to a subdomain of my website, but I’m not sure how to proceed. Maybe it’s not even a streamlit question, but I am not really well versed in domain management sadly, other than setting up the actual subdomain.

So is it possible?

Hi @peterstorm,

You’re right that it’s not exactly a Streamlit question, but I can try and point you to some information that should help.

Subdomains are handled by a webserver, like Apache2 (my go-to, highly stable) and Nginx (another popular choice for your use case).

Here is the basic setup you’re after:

  • Set up a web server (Apache2, NGinx, etc) on a machine with a public IP address.
  • Use a DNS server to point a subdomain at your webserver’s IP address.
  • Configure your web server to route requests for each subdomain to the different ports that your Streamlit apps are running on.

For example, let’s say you had 2 streamlit apps called Calvin and Hobbes.

App “Calvin” is running on port 8501. You set up app “Hobbes” to run on port 8502.

So then you would set up a webserver to “listen” for requests on subdomains calvin.somedomain.com and hobbes.subdomain.com, and route requests to port 8501 and 8502, respectively.

Check out these two tutorials, one for Apache2 and one for NGinx, that deal with setting up a webserver to redirect requests to different ports.

Thanks for your patience with a response to this question!

4 Likes