yourls配置 Configuration (in user/config.php)

文章目录
  1. 1. MySQL settings
  2. 2. Site options
  3. 3. URL Shortening settings
  4. 4. Optional settings
  5. 5. Advanced settings
  • MySQL settings

    • YOURLS_DB_USER
      your MySQL username
      Example: define( 'YOURLS_DB_USER', 'joe' );
    • YOURLS_DB_PASS
      your MySQL password
      Example: define( 'YOURLS_DB_PASS', 'MySeCreTPaSsW0rd' );
    • YOURLS_DB_NAME: The database name
      Example: define( 'YOURLS_DB_NAME', 'yourls' );
    • YOURLS_DB_HOST
      The database host
      Example: define( 'YOURLS_DB_HOST', 'localhost' );
    • YOURLS_DB_PREFIX
      The name prefix for all the tables YOURLS will need
      Example: define( 'YOURLS_DB_PREFIX', 'yourls_' );

    Site options

    • YOURLS_SITE
      Your (hopefully short) domain URL, no trailing slash, lowercase. If you pick the non-www version of your domain, don’t use the www version in your browser (and vice-versa)
      Example: define( 'YOURLS_SITE', 'http://ozh.in' );
    • YOURLS_HOURS_OFFSET
      Timezone GMT offset
      Example: define( 'YOURLS_HOURS_OFFSET', '-5' );
    • YOURLS_PRIVATE
      Private means the admin area will be protected with login/pass as defined below. See Private or Public for more.
      Example: define( 'YOURLS_PRIVATE', 'true' );
    • YOURLS_UNIQUE_URLS
      Allow multiple short URLs for a same long URL
      Set to true to allow only one pair of shortURL/longURL (default YOURLS behavior), or to false to allow creation of multiple short URLs pointing to the same long URL (as bit.ly does)
      Example: define( 'YOURLS_UNIQUE_URLS', 'true' );
    • YOURLS_COOKIEKEY
      A random secret hash used to encrypt cookies. You don’t have to remember it, make it long and complicated. Hint: generate a unique one at https://yourls.org/cookie
      Example: define( 'YOURLS_COOKIEKEY', 'qQ4KhL_pu|s@Zm7n#%:b^{A[vhm' );
    • yourls_user_passwords
      A list of username(s) and password(s) allowed to access the site if private
      Passwords can either be in plain text, or encrypted: see https://yourls.org/userpassword for more information.
      Example: 'joe' => 'mypassword'

    URL Shortening settings

    • YOURLS_URL_CONVERT
      URL shortening method: base 36 or 62. See FAQ for more explanations
    • yourls_reserved_URL
      A list of reserved keywords that won’t be used as short URLs. Define here negative, unwanted or potentially misleading keywords
      Example: 'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick'

    Optional settings

    • YOURLS_PRIVATE_INFOS
      If YOURLS_PRIVATE is set to true, you can still make stat pages public. To do so, define with:
      define('YOURLS_PRIVATE_INFOS', false);
    • YOURLS_PRIVATE_API
      If YOURLS_PRIVATE is set to true, you can still make your API public. To do so, define with:
      define('YOURLS_PRIVATE_API', false);
    • YOURLS_NOSTATS
      If YOURLS_NOSTATS is set to true, redirects won’t be logged and there will be not stats available.

    Advanced settings

    • YOURLS will look for the MySQL extension PDO, MySQLi or MySQL, in that order. If you want to force usage of one particular extension, add the following line to your config.php:
      define( 'YOURLS_DB_DRIVER', 'mysqli' );
    • You can install YOURLS behind a firewall or a proxy: see Proxy Support
    • File includes/load-yourls.php contains a few more undocumented but self explanatory and commented settings. Add them to your own config.php if you know what you’re doing.

原地址:https://yourls.org/#Config