Skip to main content
03 / How-to · Sites · 3.4

Edit the routing

Change the location blocks of a site's vhost from the Vhost tab, with nginx checking the change before it goes live.

Type
How-to guide
Needs
An administrator account, signed in to the panel with its password (an API token is not enough)
Version
a7d92ba
Last verified
2026-10-10

The routing is the block of locations that decides what serves each URL of the site: a front controller, an SPA's client-side routes, real 404 pages, a proxied /api, redirects. It is the only part of the vhost you can edit. TLS, certificates, logs, limits, the page cache and its bypass rules, the security headers and the PHP-FPM link stay the panel's.

Open the editor​

  1. Open the site.
  2. Open More and choose Vhost. Only administrators have it.

The Routing and vhost tab shows the panel's part of the vhost read-only, above and below the editor. The editor holds the current routing: at first, the site type's default.

Site typeDefault routing
WordPress, WooCommerce, PHP, Laravellocation / { try_files $uri $uri/ /index.php?$args; }
Staticlocation / { try_files $uri $uri/ /index.html =404; }
Reverse proxylocation / with proxy_pass to the upstream, the Host, X-Real-IP, X-Forwarded-For and X-Forwarded-Proto headers, websockets and a 60 s read timeout

Change the routing​

  1. Write the blocks in the editor.
  2. Choose Save.

The panel checks the block against its rules, then writes the vhost and has nginx test the configuration (nginx -t). When nginx accepts it, the panel reloads it and shows Routing saved and live. When nginx refuses it, the panel puts the previous files back, shows the error with the block's line, and the site keeps serving with its previous routing.

For example, the routing of an SPA that also has an API served by its app on port 3000:

nginx
location / {
try_files $uri $uri/ /index.html =404;
}

location /api/ {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
}

Go back to the default routing​

Choose Restore default and confirm. The site type's routing replaces your blocks.

What the panel refuses​

The block may serve only the site itself. The panel refuses, naming the line:

  • directives outside its list: among others include, logs, TLS, caching, scripting modules, fastcgi_pass and every *_pass other than proxy_pass;
  • root and alias outside <site folder>/current or <site folder>/releases/<name>, or on a hidden folder such as .git;
  • a proxy_pass to a Unix socket, with a variable, or to a system service's port on this machine or a private network (80, 443, 8443, 3306, 6379, 5252, 9080, and any listening port of a user that is not a site). The site's own app, started by its user, is reachable;
  • paths built from client values ($args, $http_*, $cookie_*, $request_uri) and any .. segment;
  • cg_* variables, which belong to the panel's cache.

A location or if block that adds its own add_header still gets the panel's security headers.

A staging copy takes production's routing, with the root and alias paths moved to its own folder.

Next step​

Schedule a task for the site.

Was this page useful?
Edit this page ↗