Install YOURLS on ubuntu 18.04

Install YOURLS on ubuntu 18.04

Install mariadb
Install nginx

$sudo mysql -u root -p
mysql>CREATE DATABASE yourls;
mysql>GRANT ALL PRIVILEGES ON yourls.* TO 'yourls'@'localhost' IDENTIFIED BY "StrongPassword";
mysql>FLUSH PRIVILEGES;
mysql>QUIT


$cd /srv
$sudo git clone https://github.com/YOURLS/YOURLS.git

$cd /srv/YOURLS/user
$sudo cp config-sample.php config.php
$sudo nano config.php
/** MySQL database username */
define( 'YOURLS_DB_USER', 'yourls' );

/** MySQL database password */
define( 'YOURLS_DB_PASS', 'StrongPassword' );

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

/** 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_SITE', 'http://yourls.example.com' );

** Server timezone GMT offset */
define( 'YOURLS_HOURS_OFFSET', '+3' );

$yourls_user_passwords = array(
'admin' => 'AdminPassword',
'wattana' => 'MyStrongPassword',


$sudo nano /etc/nginx/conf.d/yourls.conf

server {
listen 80;
server_name example.com www.example.com;
root /srv/YOURLS;
index index.php index.html index.htm;
listen [::]:80;
location / {
try_files $uri $uri/ /yourls-loader.php$is_args$args;
}

location ~ .php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
include fastcgi_params;
}
}


$sudo chown -R www-data:www-data /srv/YOURLS
$sudo nginx -t
$sudo systemctl restart nginx

connect to http://server/admin to set up