create subdomain on the same droplet for Nginx flask apps

I have followed along the tutorial on creating flask app and deploying it through Nginx

with block file defined as follows, I was wondering how can I create another subdomain that would host another flask app on the same droplet (e.g., test.your_domain).

server {
    listen 80;
    server_name your_domain www.your_domain;

    location / {
        include uwsgi_params;
        uwsgi_pass unix:/home/sammy/myproject/myproject.sock;

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @sharaf,

You need to point your subdomain to your Droplet with DigitalOcean first.

Once this is done, create a new Nginx config with the name of your droplet in your Nginx folder : /etc/nginx/sites-available/. Let’s assume your domain is test.your_domain. Name the file test.your_domain.conf.

Now you can follow the same tutorial you’ve posted for your new domain with the only difference, you just need to change the port of your flask app so that your reverse proxy works properly.