nginx
Switch the server from Apache to Nginx (ends with a reboot), or rebuild one domain's Nginx virtual host
- Command:
/go/nginx - Category: Web server
- Required argument: None
- Output: Progress text, or a single error message
- Last updated: 2026-11-21
On this page: Overview · Quick start · Syntax · Arguments · Output · Examples · Troubleshooting · Details · See also
Overview
/go/nginx has two modes:
- No argument: converts the whole server from Apache to Nginx.
- A domain: writes the Nginx virtual host file for that domain from its settings in GoAdmio.
The reverse of the first mode is apache.
[!WARNING] Without an argument, the command ends by running
/go/reboot, so the server restarts. Apache is stopped before that, so every site is down during the switch. It does not check whether the server already uses Nginx, so running it again on an Nginx server repeats the whole sequence, including the reboot.
[!NOTE] In domain mode the command only writes the file. It does not test the configuration or reload Nginx. Run
reloadorwebafterwards for the change to take effect.
Quick start
# Rebuild the Nginx virtual host of one domain
/go/nginx example.com
/go/reload
Syntax
/go/nginx # switch the server from Apache to Nginx, then reboot
/go/nginx <domain> # rebuild one domain's virtual host
Run the command as root.
Arguments
| Position | Name | Required | Notes |
|---|---|---|---|
| 1 | <domain> |
No | A hosted domain. /home/<domain> must exist. Without it, the server is converted to Nginx. |
The command has no --option flags.
Output
| Message | Meaning |
|---|---|
Switching from Apache to NGINX... |
Server conversion has started. |
NGINX: Domain Directory /home/<domain> not exists. |
Domain mode: the account folder does not exist. Nothing was written. |
File /etc/letsencrypt/options-ssl-nginx.conf not exists. Please wait... |
Domain mode: the Let's Encrypt Nginx settings file is missing, and the command is trying to copy it. See SSL requirements. |
Domain mode prints nothing else. Every call is also appended to /var/log/go/nginx.log.
Exit codes
| Situation | Exit code |
|---|---|
| Server conversion | Always 1 |
| Domain folder missing | 1 |
| Domain virtual host written | 0 |
Examples
# Rebuild one domain, then apply it
/go/nginx example.com
/go/reload
# Check the configuration before reloading
nginx -t
# Switch the whole server from Apache to Nginx (the server reboots)
/go/nginx
# Look at the generated file
cat /etc/nginx/vhost/example.com.conf
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Domain Directory /home/<domain> not exists |
The domain has no account folder. | Check the name, or create the account with create. |
| The file was rebuilt but the site did not change | Nginx was not reloaded. | Run reload or web. |
| The server rebooted | /go/nginx was run without an argument. |
This is expected. Use a domain argument to rebuild one site. |
| The file has no HTTPS section | There is no Let's Encrypt certificate for the domain, or /etc/letsencrypt/options-ssl-nginx.conf is missing. |
See SSL requirements. |
502 Bad Gateway |
The PHP-FPM socket /run/sock/<php>/<domain>.sock does not exist. |
Run fpm, or rebuild the account with conf. |
| Nginx fails to start after editing | A syntax error, often in the site's own nginx.conf. |
Run nginx -t, fix the reported line, and reload. |
| A suspended site is still reachable | The domain has no certificate. See Suspension. | Check with suspend. |
/.env or .inc files can be fetched over HTTP |
The deny rules are only in the HTTPS section. See Security notes. | Turn on the HTTPS redirect with https, and add the rules yourself in the site's nginx.conf. |
Details
Switching the server (no argument)
- Runs
/go/removessl. - Clears the
Controltable in/var/lib/sqlite/control.db. - Writes
NGINXto/usr/local/goadmio/linux/ws.db, which records the active web server. - Runs
installssl. - Disables and stops Apache (
httpdon AlmaLinux, Rocky, CentOS, Red Hat, and Fedora;apache2on Debian and Ubuntu), and enables and starts Nginx. - Runs
conf --forceto rebuild the virtual hosts, PHP-FPM pools, and SSL of every account. - Runs
/go/rebootand exits with status1.
Rebuilding one domain
The file is written to /etc/nginx/vhost/<domain>.conf, from the domain's settings in /var/lib/sqlite/site.db:
- the PHP version, or the newest installed one if none is set
- the document root:
/home/<domain>/www, or a subfolder of it if one is set (created if missing) - the bot-blocking and suspension flags
- the HTTPS redirect setting
What the file contains
| Block | Listens on | Name | Serves |
|---|---|---|---|
| Site | 443 (HTTPS) | <domain>, www.<domain> |
The website, with PHP through the domain's PHP-FPM socket |
| Site | 80 | <domain>, www.<domain> |
The website, or a redirect to HTTPS |
| Panel | 443 and 80 | go.<domain> |
The GoAdmio panel |
| Panel | 2021 (HTTPS) | <domain>, www.<domain> |
The GoAdmio panel |
| Firewall manager | 2080 (HTTPS) | <domain>, www.<domain> |
The firewall page |
| Webmail | 443 and 80 | webmail.<domain> |
Webmail |
| Webmail | 2025 and 2096 (HTTPS) | <domain>, www.<domain> |
Webmail |
The HTTPS blocks need a certificate (see below). Without one, only the three port 80 blocks (site, go.<domain>, webmail.<domain>) are written.
Other behavior of the generated file:
index.html,index.php, andgo.htmlare the index files, in that order.- On HTTPS, requests for
/goare redirected tohttps://<server hostname>/go, and/webmailtohttps://<server hostname>/go/installmail. - On HTTPS,
.incfiles and/.envreturn 403. - If
/goserverexists, requests to/goserverare proxied to the Go service on this server's port 8080. - A Coming Soon page is written to
go.htmlin the document root on every run, replacing any earlier copy.
Custom rules
If /home/<domain>/www/nginx.conf exists, it is included inside the domain's site blocks. This is where site owners add their own rules, such as rewrites. A syntax error in it stops Nginx from loading, for every site on the server.
SSL requirements
The HTTPS blocks are written only when all of these exist:
/etc/letsencrypt/live/<domain>/fullchain.pem/etc/letsencrypt/live/<domain>/privkey.pem/etc/letsencrypt/options-ssl-nginx.conf
If the last file is missing on an Nginx server, the command tries to copy it from a Python 2.7 certbot path, which does not exist on current systems. The copy then fails, and the domain silently gets the HTTP-only file. In that case, install the certbot Nginx files and run again. The generated HTTPS blocks also use http2 on;, which needs Nginx 1.25.1 or newer.
The redirect from HTTP to HTTPS is added only when SSLRedirect is on and cert.pem exists. It applies to the exact domain name only, so www.<domain> is not redirected on port 80.
Suspension
When a domain is suspended, its HTTPS and HTTP blocks redirect to https://<server hostname>/suspend. This is written only in the file that has HTTPS. The HTTP-only file for a domain without a certificate has no suspension rule.
Bot blocking
When the bot setting is on, requests whose user agent matches a blocked bot get 403. The list comes from the blocked bots in /var/lib/sqlite/bot.db whose names have no spaces. The rule is written only if the list holds at least two bots. See bot and bots.
Security notes
The .inc and /.env deny rules are written only in the HTTPS site block. The port 80 blocks have no such rules, so those files can be fetched over HTTP when the HTTPS redirect is off, and for the www host even when it is on. Add the rules to the site's own nginx.conf if the site holds such files, and keep secrets out of the document root.
What it does
flowchart TD
A["nginx [domain]"] --> B{"Domain given?"}
B -- "No" --> C["removessl, clear Control table"]
C --> D["Set web server to NGINX, installssl"]
D --> E["Stop Apache, start Nginx"]
E --> F["conf --force"]
F --> G["reboot, exit 1"]
B -- "Yes" --> H{"/home/domain exists?"}
H -- "No" --> X["Print error, exit 1"]
H -- "Yes" --> I["Read the domain's settings"]
I --> J{"Certificate and options-ssl-nginx.conf exist?"}
J -- "Yes" --> K["Write HTTPS and HTTP blocks"]
J -- "No" --> L["Write HTTP-only blocks"]
K --> M["Write go.html"]
L --> M
See also
| Command | Description |
|---|---|
apache |
Switch the server from Nginx to Apache, or rebuild a domain's Apache virtual host |
conf |
Rebuild Apache/Nginx virtual hosts, PHP-FPM pools, and SSL for all accounts |
checknginx |
Test the Nginx configuration and remove the virtual host of any domain whose certificate is missing |
reload |
Reload PHP-FPM and the active web server |
web |
Restart or reload the active web server |
https |
Enable or disable the HTTP to HTTPS redirect |
multiphp |
Change the PHP version of one domain or all domains |
installssl |
Install Let's Encrypt SSL on GoAdmio |
ssl |
Install an SSL certificate for a domain in GoAdmio |
suspend |
Suspend a GoAdmio account via the command line |