From d6c12a631ed69c13698d86c7acf37654070f11b6 Mon Sep 17 00:00:00 2001 From: Jonathan Visser Date: Wed, 24 Sep 2025 16:56:22 +0200 Subject: [PATCH 1/2] Add document "How to set up an application proxy in Nginx?" --- ...ow-to-set-up-an-application-proxy-nginx.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 docs/hypernode-platform/nginx/how-to-set-up-an-application-proxy-nginx.md diff --git a/docs/hypernode-platform/nginx/how-to-set-up-an-application-proxy-nginx.md b/docs/hypernode-platform/nginx/how-to-set-up-an-application-proxy-nginx.md new file mode 100644 index 00000000..e8ee0adc --- /dev/null +++ b/docs/hypernode-platform/nginx/how-to-set-up-an-application-proxy-nginx.md @@ -0,0 +1,50 @@ +--- +myst: + html_meta: + description: Learn how to set up an Nginx application proxy on Hypernode using Managed Vhosts: create a proxy vhost and point it to your app + title: How to set up an application proxy in Nginx? | Hypernode +--- + +# How to Set Up an Application Proxy in Nginx + +Sometimes you want to serve an application that listens on a local port (for example a Node, Python or PHP service on `localhost:3000`) behind a friendly domain on your Hypernode. Instead of writing a custom Nginx config, you can use Hypernode Managed Vhosts to generate a ready‑made proxy vhost coniguration and then just point it to your application. This keeps your configuration simple and consistent with the rest of your setup. + +## Create a proxy vhost + +Create a new vhost and set its type to `proxy`. In the example below we create a vhost for `proxy.myapp.hypernode.io`: + +```bash +app@abc123-myapp-magweb-cmbl:~$ hmv proxy.myapp.hypernode.io --type proxy +INFO: Managing configs for proxy.myapp.hypernode.io +INFO: No existing config for proxy.myapp.hypernode.io, starting with default options +INFO: Writing HTTP config for proxy.myapp.hypernode.io +``` + +This command creates a vhost directory under `/data/web/nginx//` with the proxy templates. You will see the following files: + +```bash +app@abc123-myapp-magweb-cmbl:~/nginx/proxy.myapp.hypernode.io$ ls +public.proxy.conf server.rewrites.conf staging.proxy.conf +``` + +## Point the proxy to your application + +Open `public.proxy.conf`. The only lines you normally need to change are at the top: the upstream host and port your application listens on. By default they point to `localhost:3000`. + +```nginx +app@abc123-app-magweb-cmbl:~/nginx/proxy.myapp.hypernode.io$ cat public.proxy.conf +set $app_proxy_host localhost; +set $app_proxy_port 3000; + +root /data/web/public; + +include /etc/nginx/app_proxy_handler.conf; + +location / { + echo_exec @app_proxy_handler; +} +``` + +Replace `localhost` and `3000` with the correct target for your app if it listens elsewhere. You generally do not need to change anything below those two lines. The included `app_proxy_handler.conf` wires up sensible proxy defaults, SSL, headers and buffering for you. Save the file and Nginx will apply the change. + +If you also plan to use the staging mode of this vhost, mirror the same host and port settings in `staging.proxy.conf` so that the staging switch serves the same upstream. From 7cb63477761a81ae94088c31f9b5f64574d7e85d Mon Sep 17 00:00:00 2001 From: Jonathan Visser Date: Thu, 25 Sep 2025 08:37:26 +0200 Subject: [PATCH 2/2] Use proper syntax highlighting, omit console command for reading out nginx --- .../nginx/how-to-set-up-an-application-proxy-nginx.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/docs/hypernode-platform/nginx/how-to-set-up-an-application-proxy-nginx.md b/docs/hypernode-platform/nginx/how-to-set-up-an-application-proxy-nginx.md index e8ee0adc..415cd6cf 100644 --- a/docs/hypernode-platform/nginx/how-to-set-up-an-application-proxy-nginx.md +++ b/docs/hypernode-platform/nginx/how-to-set-up-an-application-proxy-nginx.md @@ -13,8 +13,8 @@ Sometimes you want to serve an application that listens on a local port (for exa Create a new vhost and set its type to `proxy`. In the example below we create a vhost for `proxy.myapp.hypernode.io`: -```bash -app@abc123-myapp-magweb-cmbl:~$ hmv proxy.myapp.hypernode.io --type proxy +```console +app@abc123-example-magweb-cmbl:~$ hmv proxy.myapp.hypernode.io --type proxy INFO: Managing configs for proxy.myapp.hypernode.io INFO: No existing config for proxy.myapp.hypernode.io, starting with default options INFO: Writing HTTP config for proxy.myapp.hypernode.io @@ -22,7 +22,7 @@ INFO: Writing HTTP config for proxy.myapp.hypernode.io This command creates a vhost directory under `/data/web/nginx//` with the proxy templates. You will see the following files: -```bash +```console app@abc123-myapp-magweb-cmbl:~/nginx/proxy.myapp.hypernode.io$ ls public.proxy.conf server.rewrites.conf staging.proxy.conf ``` @@ -32,7 +32,6 @@ public.proxy.conf server.rewrites.conf staging.proxy.conf Open `public.proxy.conf`. The only lines you normally need to change are at the top: the upstream host and port your application listens on. By default they point to `localhost:3000`. ```nginx -app@abc123-app-magweb-cmbl:~/nginx/proxy.myapp.hypernode.io$ cat public.proxy.conf set $app_proxy_host localhost; set $app_proxy_port 3000;