GNU/Linux >> Linux Esercitazione >  >> Panels >> Panels

Come installare YOURLS su Ubuntu 14.04

In questa guida spiegheremo come installare YOURLS su un VPS Ubuntu 14.04 con MariaDB, PHP-FPM e Nginx. YOURLS sta per Your Own URL Shortener. YOURLS è un'applicazione self-hosted open source creata con PHP che ti consente di eseguire il tuo servizio di abbreviazione degli URL. Questa guida dovrebbe funzionare anche su altri sistemi VPS Linux, ma è stata testata e scritta per un VPS Ubuntu 14.04.

Accedi al tuo VPS tramite SSH

ssh user@vps_IP

Aggiorna il sistema e installa i pacchetti necessari

[user]$ sudo apt-get update && sudo apt-get -y upgrade
[user]$ sudo apt-get install software-properties-common git nano

Installa MariaDB 10.1

Per aggiungere il repository MariaDB all'elenco delle fonti e installare l'ultimo server MariaDB, esegui i seguenti comandi:

[user]$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
[user]$ sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/10.1/ubuntu trusty main'
[user]$ sudo apt-get update
[user]$ sudo apt-get install -y mariadb-server

Al termine dell'installazione, eseguire il comando seguente per proteggere l'installazione:

[user]$ mysql_secure_installation

Successivamente, dobbiamo creare un database per l'installazione di YOURLS.

[user]$ mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE yourls;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON yourls.* TO 'yourls'@'localhost' IDENTIFIED BY 'yourls_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Installa PHP, compositore e moduli PHP richiesti

Per installare l'ultima versione stabile di PHP versione 7 e tutti i moduli necessari, esegui:

[user]$ sudo add-apt-repository -y ppa:ondrej/php-7.0
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install php7.0-fpm php7.0-cli php7.0-mysql php7.0-curl

Configurazione PHP-FPM

Crea un nuovo pool PHP-FPM per il tuo utente:

[user]$ sudo nano /etc/php/7.0/fpm/pool.d/your_user.conf
[your_user]
user = your_user
group = your_user
listen = /var/run/php/php7.0-fpm-your_user.sock
listen.owner = your_user
listen.group = your_user
listen.mode = 0666
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 200
chdir = /

Non dimenticare di cambiare tuo_utente con il tuo nome utente.

Riavvia PHP-FPM:

[user]$ sudo service php7.0-fpm restart

Clone e configura i TUOI

Crea una directory principale per l'installazione YOURLS usando il seguente comando:

[user]$ mkdir -p ~/myYOURLS.com/{public_html,logs}

Clona il repository github

[user]$ git clone --branch master https://github.com/YOURLS/YOURLS.git ~/myYOURLS.com/public_html

Copia il user/config-sample.php file in user/config.php .

[user]$ cp ~/myYOURLS.com/public_html/user/config-sample.php ~/myYOURLS.com/public_html/user/config.php

Apri user/config.php archiviare e modificare i seguenti valori

[user]$ nano ~/myYOURLS.com/public_html/user/config.php
/** MySQL database username */define( 'YOURLS_DB_USER', 'yourls' );

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

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

** If you define it to "http://sho.rt", don't use "http://www.sho.rt" in your browser (and vice-versa) */define( 'YOURLS_SITE', 'http://myYOURLS.com' );

/** 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', 'fNK$M]~BfF&f0S#{X3P)sMM#A%2)R27D&THBMa8V' );

/** 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(
        'your_username' => 'your_password',
        // 'username2' => 'password2',
        // You can have one or more 'login'=>'password' lines
        );

Installa e configura Nginx

Ubuntu 14.04 viene fornito con nginx versione 1.4, per installare l'ultima versione stabile di Nginx versione 1.8, esegui:

[user]$ sudo add-apt-repository -y ppa:nginx/stable
[user]$ sudo apt-get update
[user]$ sudo apt-get -y install nginx

Crea un nuovo blocco server Nginx con il seguente contenuto:

[user]$ sudo nano /etc/nginx/sites-available/myYOURLS.com
server {
    listen      80;
    server_name myYOURLS.com;
    root        /home/your_user/myYOURLS.com/public_html;

    access_log /home/your_user/myYOURLS.com/logs/access.log;
    error_log /home/your_user/myYOURLS.com/logs/error.log;

    index index.php;

    location / {
        try_files $uri $uri/ /yourls-loader.php;
        expires 14d;
        add_header Cache-Control 'public';
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm-your_user.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
    }
}

Non dimenticare di cambiare tuo_utente con il tuo nome utente.

Attiva il blocco del server creando un collegamento simbolico :

[user]$ sudo ln -s /etc/nginx/sites-available/myYOURLS.com /etc/nginx/sites-enabled/myYOURLS.com

Testare la configurazione di Nginx e riavviare nginx:

[user]$ sudo nginx -t
[user]$ sudo service nginx restart

Passaggi finali

Apri http://myYOURLS.com/admin nel tuo browser web preferito e dovresti vedere la schermata di installazione di YOURLS. Fare clic sul pulsante 'Install YourLS' per popolare il database.

Questo è tutto. Hai installato con successo YOURLS sul tuo Ubuntu 14.04 VPS. Per maggiori informazioni su come gestire la tua installazione di YOURLS, fai riferimento alla documentazione ufficiale di YOURLS.

Ovviamente non devi fare nulla di tutto ciò se utilizzi uno dei nostri servizi di hosting VPS Linux, nel qual caso puoi semplicemente chiedere ai nostri esperti amministratori Linux di configurarlo per te. Sono disponibili 24 ore su 24, 7 giorni su 7 e si prenderanno immediatamente cura della tua richiesta.

PS . Se questo post ti è piaciuto condividilo con i tuoi amici sui social network utilizzando i pulsanti a sinistra o semplicemente lascia una risposta qui sotto. Grazie.


Panels
  1. Come installare Koken su Ubuntu

  2. Come installare Pligg CMS su Ubuntu 14.04

  3. Come installare Wekan su Ubuntu 14.04

  4. Come installare e107 CMS su Ubuntu 14.04

  5. Come installare Pimcore su Ubuntu

Come installare Sonerezh su Ubuntu 14.04

Come installare Pixie su Ubuntu 14.04

Come installare Koel su Ubuntu 14.04

Come installare CubeCart su Ubuntu 14.04

Come installare Zenphoto su Ubuntu 14.04

Come installare CachetHQ su Ubuntu 16.04