ServerAvatarDocs
Reference & troubleshooting

Web server configuration

How the panel writes each site's nginx, Apache or OpenLiteSpeed configuration, where the files are, where to put your own rules, and what every site gets by default.

The panel writes every site's web server configuration itself, from the site's settings: its domains, its certificate, its PHP version, its protection rules. You don't edit those files; you change the site in the panel and the panel rewrites them. This page says where the files are, what is in them, and where your own rules go.

Which web server a server runs depends on its stack: nginx on LEMP, Apache on LAMP, OpenLiteSpeed on OLS. The file layout follows v7 of ServerAvatar, so a server moved from v7 keeps the file names it already had.

Where the files are

For nginx and Apache each site has two files in sites-available, linked into sites-enabled:

FileWhat it holds
<name>.confThe site on port 80.
<name>-le-ssl.confThe site on port 443, with a Let's Encrypt certificate.
<name>-ssl.confThe same, with a certificate you supplied.

<name> is the application's name. The folders are /etc/nginx/ and /etc/apache2/. An OpenLiteSpeed site is a folder under /usr/local/lsws/conf/vhosts/<name>/ with a vhconf.conf, plus entries in the server's httpd_config.conf. A server moved from v7 keeps v7's own OpenLiteSpeed layout (a folder under /etc/ with a main.conf).

Each site also has a folder in its own home, with the site's logs and the panel's own files:

PathWhat it is
/home/<user>/<name>/public_htmlThe web root (the Files screen starts here).
/home/<user>/<name>/logs/The site's access and error logs. nginx and Apache write access.log and error.log for port 80 and access-ssl.log and error-ssl.log for port 443; OpenLiteSpeed writes access.log and error.log.
/home/<user>/<name>/conf/<web server>/The folder for your own rules, below. <web server> is nginx, apache or openlitespeed.
/home/<user>/<name>/.panel/The panel's own bookkeeping for the site. It is above the web root, so no visitor can fetch it.
/etc/panel-site-rules/<name>/A second root-owned folder of *.conf rules the site loads, outside the site's home. The panel creates and removes it with the site and never rewrites what is in it; add-ons put rules there (for example the WordPress Toolkit's xmlrpc and uploads blocks).

Add your own rules

The site's configuration loads every *.conf file in conf/<web server>/ (on Apache, every file in it) at the end of the site, so you can add a header, a redirect or a location block without touching the panel's files. On OpenLiteSpeed, rewrite rules go in conf/openlitespeed/rewrites/, which the site's rewrite section loads.

The folder belongs to root

The folder and every file in it are owned by root, and the site's user can read them but not change them. The web server reads them as root, so anyone who could write there as the site's user (including a hacked site) could add web server configuration that runs as root. Add rules over SSH with sudo. The Files screen runs as the site's user and can't write there.

Test the web server's configuration before you reload it: sudo nginx -t for nginx, sudo apachectl configtest for Apache. A rule with a syntax error stops the whole web server from loading its configuration, not just this site.

The site's own files (<name>.conf and the HTTPS file) are rendered from a template and rewritten on every domain, certificate or HTTPS change, so anything written into them by hand is lost on the next one. Put your rules in the conf folder.

What every site gets

These are what the panel writes by default, as seen in an nginx PHP site. Apache and OpenLiteSpeed sites get the same behaviour in their own syntax.

  • HTTP/2 and TLS. Port 443 is served with HTTP/2 and only TLS 1.2 and 1.3. Apache serves h2 as well, with Protocols h2 http/1.1.
  • Upload size. The largest request the web server accepts follows the site's PHP post_max_size (never less than 1 MB), so the web server and PHP agree. Change it in PHP Settings.
  • PHP timeout. nginx waits for PHP for 300 seconds, or the site's max_execution_time plus 30 seconds if that is longer, so nginx never cuts PHP off first.
  • Browser caching. nginx sends cache headers by file type: images, fonts, audio, video, archives and PDFs for 30 days; CSS and JavaScript for 7 days; JSON, XML, text and source maps for 1 hour. Those requests are left out of the access log. Apache sets expiry times by type (images, CSS and JavaScript for a month, HTML for 10 minutes, anything else for 2 days), and OpenLiteSpeed sets a one-year expiry for images, CSS, JavaScript and fonts.
  • Dotfiles are refused. Any request for a path containing a dot-folder or dotfile (.git, .env) is denied, except .well-known, which Let's Encrypt needs.
  • The Authorization header reaches PHP. Apache's PHP handler drops it by default; the panel passes it on so API tokens and JWTs work, as in v7.
  • Certificate checks. /.well-known/acme-challenge/ is answered from /var/www/html so certificates can be issued and renewed.
  • OpenLiteSpeed worker pool. Each OpenLiteSpeed PHP site allows up to 35 PHP workers, the same as v7. It is a ceiling, not a reservation. The number is a panel setting, not a field on a screen: the panel's SERVER_OLS_LSAPI_CHILDREN environment value, applied when a site's configuration is next written. Lower it on a small server with many busy sites.

Visitor addresses behind Cloudflare

Behind Cloudflare, every request reaches the server from one of Cloudflare's own addresses. Without a fix the access logs, the bot report, the web firewall log and Fail2ban would all see Cloudflare, and a Fail2ban ban would land on an address that carries many sites' real visitors.

The panel switches this on by itself on every server. There is nothing to turn on:

Web serverWhat the panel writes
nginx/etc/nginx/conf.d/remoteip.conf: real_ip_header CF-Connecting-IP; and one set_real_ip_from line for each Cloudflare range.
Apache/etc/apache2/conf-enabled/remoteip.conf: RemoteIPHeader CF-Connecting-IP and one RemoteIPTrustedProxy line for each Cloudflare range, active once mod_remoteip is enabled.
OpenLiteSpeedThe proxy-header setting is Trusted IP Only (useIpInProxyHeader 2) and Cloudflare's ranges are added to the server's Allowed List as trusted addresses. A full OpenLiteSpeed restart applies it; a graceful reload keeps the old list.

Only Cloudflare's own ranges are trusted, on every web server, so a visitor can't pick the address the server logs and bans by sending the header themselves (v7 on OpenLiteSpeed trusted the header from anyone). The panel leaves alone a server that already sets the header somewhere else, including a server moved from v7 with its own file. On OpenLiteSpeed it also leaves alone a server whose owner chose another proxy-header mode (every server moved from v7 has Yes) or whose Allowed List is not open to everyone.

Compression (nginx)

Ubuntu's nginx compresses only HTML by default. On nginx the panel switches on the rest of the standard settings in /etc/nginx/nginx.conf, the same as v7: gzip_proxied any, gzip_comp_level 6, gzip_buffers 16 8k, gzip_http_version 1.1 and gzip_types for plain text, CSS, JSON, JavaScript and XML. It only fills in lines nothing sets yet. A server that has gzip off, or no gzip on, is left alone, and the change is tested before nginx reloads and taken back if the test fails.

Names no site claims

If someone points a domain at your server's IP that no site on it uses, the server must not show another customer's site or certificate. The panel writes a neutral default:

Web serverPort 80Port 443
nginx/etc/nginx/sites-available/default answers 404.000-default-ssl.conf refuses the TLS handshake.
Apache000-default.conf denies every request.000-default-ssl.conf denies every request, under a placeholder certificate, so the visitor sees a certificate error and never another site.
OpenLiteSpeedThe listener answers with a neutral certificate rather than the panel's.

Apache gives an unknown name to the first site it loaded for that port, which used to be a customer's site; the 000- names sort first in sites-enabled. The panel writes these files only over nothing, the package's untouched original or its own earlier copy. A default that you or v7 wrote yourself is left to serve.

Node.js applications

A Node.js application is a proxy in front of its own process. nginx waits up to 10 seconds to connect and 60 seconds to read or send (Apache the same: connection 10 s, timeout 60 s). While the process is restarting or down, nginx answers with a 503 page that reads "This site is restarting. Please try again in a moment. If this keeps happening, the site owner should check the application's logs."

How a change is applied

The panel tests the web server's configuration before it reloads it, and puts the previous configuration back if the test fails, so a bad change doesn't take the web server down. If the configuration is fine but the web server doesn't reload, the panel says so instead of reporting success: "Your change was saved and passed the configuration test, but the web server did not reload, so it is still serving the previous settings. Restart the web server from Services, or check its log."

On this page