LuckyBX Русский
Server

Your own nginx rules

Each site has a file that LuckyBX does not overwrite:

/etc/nginx/luckybx/shop.example.com.custom.conf

Its lines go inside the site settings. After editing, check them and apply:

nginx -t && systemctl reload nginx

If the file has an error, the first command shows it, and the site keeps working the old way.

Send an old page to a new one#

location = /old-page/ { return 301 /new-page/; }

Block a file#

location = /secret.html { deny all; }

Rebuild the settings#

If the nginx settings of some site were broken by accident, they can be built again. Your custom.conf files stay:

luckybx site rebuild

What not to do#

Do not write rules for whole folders that contain PHP files. Such a rule can give a visitor the program text instead of the page.

The admin area can be restricted by address without editing files, see Security.

Rules from .htaccess are read by Apache, which can be turned on for a site: Apache.