Linux

Where Does YOURLS Store Config and Links?

YOURLS reads user/config.php for database and site settings. Links live in MySQL; plugins beside the config.

Last updated

YOURLS centers on user/config.php: MySQL credentials and prefix, site URL, cookie key, admin logins, and feature flags. Everything else (links, clicks, users) lives in MySQL. Plugins drop into user/plugins beside the config. Docker images accept the same settings as environment variables, which suits containers better than a baked file.

Permissions matter uniquely here: the config holds DB passwords in plaintext PHP, so guides recommend chmod 440/600 after setup. Cookie key changes log everyone out, which doubles as a cheap session reset. The database must exist before install; YOURLS creates tables, not databases.

Where YOURLS stores this, by platform

Linux
user/config.php (install root)

DB credentials, site URL, cookie key, admins. Copy from config-sample.php; plain ASCII, no BOM. Docker uses YOURLS_* env instead. Chmod restrictive after setup; plugins sit beside it.

Frequently asked questions

how do i back up yourls

Copy user/config.php plus a MySQL dump with the app stopped. Links, clicks, and users travel in the database; salts and DB credentials travel in the file. Restore both; chmod the file restrictive (440/600) after.

how do i create the yourls config file

Copy user/config-sample.php to user/config.php and fill DB credentials, site URL (lowercase, no trailing slash), and cookie key. Docker images take the same values as YOURLS_* env vars instead. The installer refuses to run without it.

Notice an outdated path? Let us know.