How to setup droplet as subdirectory of App

Hi, I have an App running a Hugo site and I have a droplet running a HTML site (with PHP). I would like to have my App accessible from the main domain all variations of - | | and have the HTML site available as a subfolder -

I have the app working and the droplet working, but can’t figure out how to integrate the two.

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.

Bobby Iliev
Site Moderator
Site Moderator badge
April 16, 2023

Hi there,

To serve the HTML site as a subfolder of your main domain, you can use reverse proxy functionality in Nginx:

To do this, first, you need to make sure your Droplet with the HTML site has a domain name or a subdomain pointing to it.

For example, you can create a subdomain like and point it to the droplet’s IP address.

Next, you need to configure Nginx on the server running the Hugo site to proxy requests for the subfolder to the droplet with the HTML site. You’ll need to modify the Nginx configuration file, typically found at /etc/nginx/sites-available/default. Here’s an example configuration:

server {
    listen 80;

    # Serve Hugo site
    location / {
        root /path/to/hugo/public;
        try_files $uri $uri/ =404;

    # Proxy requests for the subfolder to the HTML site droplet
    location /subsite/ {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

Make sure to replace /path/to/hugo/public with the correct path to your Hugo site’s public directory, and with the correct domain or subdomain of your HTML site.

After modifying the configuration, restart the Nginx service:

sudo service nginx restart

Now, your main domain should serve the Hugo site, and the /subsite path should proxy requests to the droplet running the HTML site.



Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up