Tutorial: Serving a Custom Static Site on Instantly.run with Nginx

This tutorial walks you through running an Nginx container without specifying --domainname (so Instantly.run auto-generates it), uploading a styled index.html via docker cp, and accessing your site at the generated URL.


1. Run the Nginx Container

Run Nginx in detached mode. Omitting --domainname lets Instantly.run assign a domain using the pattern <name>-<tenant>.app.instantly.run.

instantly run -d --name nginx   -p 80:80   nginx:latest
  • --name nginx sets the container name to nginx.
  • -p 80:80 maps public port 80 to the container’s port 80.
  • Generated URL: https://nginx-instantly.app.instantly.run

2. Create a Custom index.html

Locally, create a file named index.html with the following content:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Hello from Instantly.run</title>
  <style>
    body { 
      font-family: sans-serif; 
      text-align: center; 
      padding-top: 50px; 
      background-color: #f0f0f0; 
    }
    .container { 
      background: white; 
      padding: 40px; 
      border-radius: 8px; 
      box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
      display: inline-block; 
    }
    h1 { color: #333; }
    a { color: #0066cc; text-decoration: none; }
    a:hover { text-decoration: underline; }
  </style>
</head>
<body>
  <div class="container">
    <h1>Hello World by Instantly.run</h1>
    <p>Visit <a href="https://instantly.run" target="_blank">https://instantly.run</a></p>
  </div>
</body>
</html>

3. Upload index.html to the Container

Use docker cp to copy your local index.html into Nginx’s default content directory:

instantly cp index.html nginx:/usr/share/nginx/html/index.html

4. Access Your Site

Open your browser to the auto-generated URL:

https://nginx-instantly.app.instantly.run

You should see your styled “Hello World by Instantly.run” page.


Next Steps

  • Customize further by uploading CSS or additional assets.
  • Experiment with other Docker commands in this guide.
  • Check logs with instantly logs nginx if anything goes wrong.

Happy hosting on Instantly.run!