aaPanel Toolkit

In aaPanel “Multi-WebServer” setups, Nginx is usually in front and OpenLiteSpeed (OLS) is behind it. WP Ghost needs certain requests to reach the backend correctly, but a common issue is this:

  • Nginx tries to treat “static files” (CSS, JS, images, fonts, etc.) as files that must exist on disk.
  • If a “static-looking” URL does not exist (because of rewrites), Nginx may return 404 or may not let OLS apply rewrites.
  • Result: WP Ghost looks enabled, but the assets do not load correctly.

The fix is to add a smart rule in Nginx:
If a static-looking file exists, serve it normally. If it does not exist, forward it to OpenLiteSpeed so the rewrite rules can apply.

To make this easy, download, unpack and use the following script.

  1. Download and unpack the script
  2. Upload the sh script to your website root folder in aaPanel
  3. Make it executable
  4. Run it once
  5. The script automatically updates Nginx rules and reloads Nginx

Upload the script in aaPanel

aaPanel WP Toolkit
  1. Log in to aaPanel and go to Website or WP Tookit
  2. Find your domain and click Root (or File / Document Root depending on aaPanel version)
  3. Open the website root folder (e.g: /www/wwwroot/yourdomain.com/)
  4. Click Upload and upload the script file in the root folder
Upload script file

Make the script executable

  1. In aaPanel, open Terminal (left menu)
  2. Go to your site root folder:
cd /www/wwwroot/yourdomain.com
  1. Make the script executable:
chmod +x openlitespeed.sh
aaPanel make executable

Run the script

Run it like this:

./openlitespeed.sh

Optional: run it only for one domain (useful if you host many sites):

./openlitespeed.sh yourdomain.com

When it finishes, you should see messages like:

  • “Testing nginx config…”
  • “Reloading nginx…”
  • “Done.”

That means the fix is applied.

aaPanel run script

What the script does

Think of it like a “traffic director” between Nginx and OpenLiteSpeed.

Here is what it changes, in plain terms:

  1. Finds all your Nginx website configs in aaPanel
    It scans: /www/server/panel/vhost/nginx/*.conf
  2. Detects which OpenLiteSpeed upstream each domain uses
    This is how it knows where Nginx should forward requests
  3. Creates a small Nginx “extension snippet” per domain
    It writes a file here:
    /www/server/panel/vhost/nginx/extension/<domain>/static-fallback.conf
  4. Adds one important rule for static-looking URLs
    • If the file exists on disk: Nginx serves it normally (fast)
    • If the file does not exist: Nginx forwards the request to OpenLiteSpeed, so rewrites can work (this is the WP Ghost requirement for rewritten asset paths)
  5. Safely tests and reloads Nginx
    • Runs nginx -t to ensure config is valid
    • Reloads Nginx so changes apply immediately

It also makes backups of the snippet if it already exists (adds a .bak.<timestamp> copy).


How to confirm it worked

After running the script and the NGINX server restarts:

  1. Go to WP Ghost > Change Paths section
  2. Click Frontend Test
  3. Click Login Test
Frontend test success

If you use caching (LiteSpeed Cache, Cloudflare, other CDN), clear cache once to avoid old asset paths being served.

Practical note

This fix does not “replace” OpenLiteSpeed or change WordPress.
It simply ensures that when WP Ghost uses rewritten URLs, the request reaches the right server layer so the rewrite can be applied instead of being blocked as a missing file.

Troubleshooting

“Permission denied” when running the script

You are not in the correct folder, or it is not executable.

Run:

cd /www/wwwroot/yourdomain.com
chmod +x openlitespeed.sh
./openlitespeed.sh

“nginx binary not found” or “vhost dir not found”

This usually means:

  • You are not on an aaPanel server with Nginx installed in the standard location, or
  • Multi-WebServer is not enabled the way this script expects.

The script checks for common aaPanel paths and will stop safely if they are missing.

Nginx reload fails

If aaPanel’s nginx service is not active, the script tries alternative reload methods (reload, then restart if needed).
If it still fails, open aaPanel, App Store > confirm Nginx is installed and running