Wydrukuj tę dokumentację Pokaż jako slajdy

Your Own URL

Instalacja oprogramowania

Za pomocą własnego repozytorium pakietów należy wykonać instalację aplikacji

pkg install -Uy www/yourls

Konfiguracja bazy mySQL

CREATE DATABASE yourlsdb;
CREATE USER 'yourls'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL ON yourlsdb.* TO 'yourls'@'%';
flush privileges;

user/config.php

--- /usr/local/www/yourls/user/config.php       2014-01-09 21:46:53.000000000 +0100
+++ /usr/local/www/yourls/user/config.php.new   2018-09-30 17:39:35.928726000 +0200
@@ -8,20 +8,20 @@
  */

 /** MySQL database username */
-define( 'YOURLS_DB_USER', 'your db user name' );
+define( 'YOURLS_DB_USER', 'yourls' );

 /** MySQL database password */
-define( 'YOURLS_DB_PASS', 'your db password' );
+define( 'YOURLS_DB_PASS', '<password>' );

 /** The name of the database for YOURLS */
-define( 'YOURLS_DB_NAME', 'yourls' );
+define( 'YOURLS_DB_NAME', 'yourlsdb' );

 /** MySQL hostname.
  ** If using a non standard port, specify it like 'hostname:port', eg. 'localhost:9999' or '127.0.0.1:666' */
 define( 'YOURLS_DB_HOST', 'localhost' );

 /** MySQL tables prefix */
-define( 'YOURLS_DB_PREFIX', 'yourls_' );
+define( 'YOURLS_DB_PREFIX', '' );

 /*
  ** Site options
@@ -29,16 +29,16 @@ define( 'YOURLS_DB_PREFIX', 'yourls_' );

 /** YOURLS installation URL -- all lowercase and with no trailing slash.
  ** If you define it to "http://site.com", don't use "http://www.site.com" in your browser (and vice-versa) */
-define( 'YOURLS_SITE', 'http://site.com' );
+define( 'YOURLS_SITE', 'https://yl.wtp3.org' );

 /** Timezone GMT offset */
-define( 'YOURLS_HOURS_OFFSET', 0 );
+define( 'YOURLS_HOURS_OFFSET', 1 );

 /** YOURLS language or "locale".
  ** Change this setting to "localize" YOURLS (use a translation instead of the default English). A corresponding .mo file
  ** must be installed in the user/language directory.
  ** See http://yourls.org/translations for more information */
-define( 'YOURLS_LANG', '' );
+define( 'YOURLS_LANG', 'pl_PL' );

 /** Allow multiple short URLs for a same long URL
  ** Set to true to have only one pair of shortURL/longURL (default YOURLS behavior)
@@ -51,14 +51,13 @@ define( 'YOURLS_UNIQUE_URLS', true );
 define( 'YOURLS_PRIVATE', true );

 /** A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: copy from http://yourls.org/cookie **/
-define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );
+define( 'YOURLS_COOKIEKEY', 'v_3zR~gODKhcYPh@SH#8YApL1hd0mg$sPg52knxc' );

 /** Username(s) and password(s) allowed to access the site. Passwords either in plain text or as encrypted hashes
  ** YOURLS will auto encrypt plain text passwords in this file
  ** Read http://yourls.org/userpassword for more information */
 $yourls_user_passwords = array(
-       'username' => 'password',
-       'username2' => 'password2'      // You can have one or more 'login'=>'password' lines
+       'wtps0nx' => '<password>',
        );

 /** Debug mode to output some internal information

Zmiana uprawnień

Zgodnie z dokumentacją yourls hasła w pliku konfiguracyjnym powinny być zahashowane. W związku z tym należy zmienić uprawnienia do pliku, tak aby serwer webowy mógł zmodyfikować plik:

chmod 0644 /usr/local/www/yourls/user/config.php
chown www:www /usr/local/www/yourls/user/config.php

Lokalizacja

Istnieje polskie tłumaczenie interfejsu yourls. W tym celu należy:

fetch https://github.com/tomslominski/YOURLS-pl_PL/archive/master.zip -o /tmp/yourls-pl.zip
unzip -d /usr/local/www/yourls/user/languages/ -j -x pl_PL.* /tmp/yourls-pl.zip

Skracacz prywatny, ale interfejs publiczny

Zgodnie z zaleceniami dokumentacji [1] panel adminsitrcyjny yourls powinien być zabezpieczony hasłem. Natomiast można mieć dostępny publiczny panel. Można to zrobić poprzez:

cp -p /usr/local/www/yourls/sample-public-front-page.txt /usr/local/www/yourls/index.php

A następnie należy plik odpowiednio dostosować. /!\ TBA /!\

Źródła w sieci internet


{i}  (c) 2004 - 2026 BSD Serwis Krzysztof Stryjek. W przypadku błędów, poprawek proszę kontaktować się z administratorem wiki.

YourLs (ostatnio edytowane 2018-09-30 16:02:08 przez wtps0n)