A website being accessible doesn't mean it's ready to go live. If any one of security policies, rate limiting, HTTPS, directory permissions, and backups is missed, it can turn into an incident later. This article follows the 'must confirm before launch' order and separates what X1 already does automatically from what the site owner needs to confirm.

1. CSP: already added by the program
Every response carries a Content-Security-Policy header, and no configuration in the admin panel is needed. The core of the current policy is: scripts are only allowed from the same origin or inline scripts with a nonce, styles allow inline, images allow same origin, data:, and blob:, and objects are forbidden entirely.
The difference between the admin panel and frontend is in frame-ancestors: the admin panel is 'none' and additionally sends X-Frame-Options: DENY, so it cannot be embedded in any page; the frontend is 'self', allowing same-origin embedding. The practical impact is: third-party analytics, customer service, and ad scripts will be blocked; external fonts and external APIs are also restricted by font-src and connect-src. To allow them, you can only modify the CSP in code; do not add unsafe-eval just to save trouble.
2. Rate limiting: the program and nginx each handle one layer
- nginx PHP requests: the same IP averages 10 requests/second, with a burst of 20 (
limit_req); - Admin login: the same IP and the same username each allow at most 5 failures within 15 minutes; exceeding that locks for 15 minutes;
- First admin creation: the same IP allows at most 5 attempts within 15 minutes;
- Frontend language switching: the same IP allows 30 requests per minute;
- Public API: each token defaults to 60 reads/minute and 10 orders/minute, adjustable when creating the token.
Rate limiting for login and first-time installation is recorded by the program's own rate_buckets table and does not depend on nginx; it is still recommended to keep the nginx layer to block high-frequency requests.

3. HTTPS and callbacks
A production site should be configured with HTTPS and redirect HTTP to HTTPS. The reason is not just browser warnings: WeChat Pay and Alipay callback URLs depend on HTTPS; session cookies carry the Secure flag only when HTTPS is detected; admin login, settings saving, and suggested URLs should all use HTTPS.
4. Files and directories
- The site root points only to
public/;app/anddata/are outside the site root and cannot be accessed directly via URL; data/uploads/is exposed externally through nginx's/media/alias; that location must have PHP execution disabled;- nginx forbids access to dotfiles, keeping only
/.well-known/for certificate verification; data/app.keypermissions should be0600; do not delete or replace it; after loss, already encrypted DeepSeek keys, payment private keys, and push tokens cannot be decrypted;- Only the user running the website should have write permission to
data/; do not make it writable by everyone.
5. Backups must include app.key
The SQLite database and app.key must be backed up together. If you back up only the database and not app.key, encrypted fields cannot be recovered. For manual backups, use sqlite3 .backup; do not directly copy a .sqlite file that is being written to; place backups outside the site directory; locally stored images are in data/uploads/, back them up together when needed.
6. Launch checklist
- HTTPS site-wide, HTTP already redirected;
- The site root is
public/,/media/has PHP execution disabled, and dotfiles are forbidden; app.keyis 0600, anddata/is writable only by the web user;- Admin login rate limiting is active, and the first-time installation entry is closed;
- The database +
app.keyhave been backed up outside the site directory; - There are no CSP blocks in the browser console; when integrating third-party scripts, modify the CSP code first and do not add
unsafe-eval.
Summary
X1 has already built CSP, login rate limiting, and cookie Secure into the program; what really needs human confirmation before launch is HTTPS, directory permissions, app.key, and backups. Going through these six items saves much more trouble than patching things after launch.