Hosting Gatsby on a subdirectory using NGINX
GatsbyJS is a static site generator, which means it outputs static HTML, CSS and JS. You don't actually need to set up a NodeJS server to make it run. gatsby develop
should only be used in development (locally), not in production.
Basically, you'll want to run gatsby build
and move/upload all the files inside the local public
directory to the subdirectory on your server. Of course, that subdirectory needs to be publicly available/served via NGINX, Apache or similar. For example by:
location /subdirectory { root /html/my-site/public; index.html;}
Find more details on deploying GatsbyJS here. Also, don't forget to add a Path Prefix.