Skip to main content
This guide will help you deploy static content with Nginx on Zerops. You’ll create a service, configure it, and deploy your application.

Prerequisites

  • A Zerops account (sign up if you don’t have one)
  • A project in Zerops (create one in the GUI if needed)

Step 1: Create Nginx Service

You can create an Nginx service using either the Zerops GUI or zCLI.
  1. Navigate to your project dashboard
  2. Click Add new service in the Services menu
  3. Select Nginx as the service type
  4. Choose your Nginx version (or use latest)
  5. Set a unique hostname (e.g., app, web, frontend)
  6. Optionally configure:
    • Secret environment variables
    • Auto scaling settings
  7. Click Create service
The hostname must be unique within your project, contain only lowercase letters (a-z) or numbers (0-9), and be maximum 25 characters.

Step 2: Configure Your Application

Create a zerops.yaml file in the root of your repository to configure how Zerops builds and runs your application.
If you already have built static files and just want to deploy them:
zerops.yaml
zerops:
  - setup: app
    run:
      base: nginx@latest
      documentRoot: public
This minimal configuration:
  • Uses the latest Nginx version
  • Serves files from the /var/www/public directory
  • Uses default settings for everything else

Step 3: Deploy Your Application

The recommended approach is to connect your Git repository:
  1. Go to your service detail in Zerops GUI
  2. Click Connect to GitHub/GitLab
  3. Authorize Zerops and select your repository
  4. Choose the branch to deploy from
  5. Zerops will automatically detect your zerops.yaml
  6. Click Deploy
Set up automatic deployments by enabling Deploy on push. Every commit to your selected branch will trigger a new deployment.

Step 4: Configure Public Access

By default, your service is only accessible within the Zerops private network. To make it publicly accessible:
  1. Go to your service detail in Zerops GUI
  2. Navigate to Public access & routing in the left menu
  3. Click Add new routing rule
  4. Configure your domain:
    • Use a Zerops subdomain (e.g., app.zerops.app)
    • Or add your custom domain
  5. Save the routing rule
For custom domains, you’ll need to add DNS records pointing to Zerops. The GUI will show you exactly what records to create.

Example: Deploy a React App

Here’s a complete example for deploying a React application:
zerops.yaml
zerops:
  - setup: app
    build:
      base: nodejs@20
      buildCommands:
        - npm ci
        - npm run build
      deployFiles:
        - build/~
      cache: node_modules
    run:
      base: nginx@latest
      documentRoot: build
Project structure:
my-react-app/
├── public/
├── src/
├── package.json
├── package-lock.json
└── zerops.yaml
Deployment steps:
  1. Add zerops.yaml to your React project root
  2. Commit and push to your Git repository
  3. Connect the repository in Zerops GUI
  4. Watch the build and deploy process
  5. Access your app via the provided URL

Next Steps

Environment Variables

Configure environment variables

Custom Nginx Config

Customize your web server

SEO Optimization

Set up Prerender.io for better SEO

Scaling

Configure auto scaling

Common Issues

Check that your documentRoot in zerops.yaml matches where your build output is located. For example, if your build creates a dist folder, use documentRoot: dist.
The default Nginx configuration handles this automatically with try_files $uri $uri/ /index.html. If you’ve customized your Nginx config, make sure you have this directive.
Make sure you’re using the correct base image for your build. For example, if you’re using npm commands, you need base: nodejs@<version> in your build section.
Go to your service detail in Zerops GUI, click on Service dashboard & runtime containers, then Open pipeline detail to see complete build and deploy logs.

Build docs developers (and LLMs) love