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 - mysite.com | www.mysite.com | https://mysite.com and have the HTML site available as a subfolder - www.mysite.com/subsite
I have the app working and the droplet working, but can’t figure out how to integrate the two.
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!
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.
Hi there,
To serve the HTML site as a subfolder of your main domain, you can use reverse proxy functionality in Nginx:
https://www.digitalocean.com/community/tutorials/how-to-configure-nginx-as-a-reverse-proxy-on-ubuntu-22-04
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
htmlsite.mysite.com
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:Make sure to replace
/path/to/hugo/public
with the correct path to your Hugo site’spublic
directory, andhttp://htmlsite.mysite.com
with the correct domain or subdomain of your HTML site.After modifying the configuration, restart the Nginx service:
Now, your main domain should serve the Hugo site, and the
/subsite
path should proxy requests to the droplet running the HTML site.Best,
Bobby