====== Sistemas Acortar URLs ====== Los que se han probado de la [[https://github.com/awesome-selfhosted/awesome-selfhosted#url-shorteners|lista encontrada]] son: -[[https://github.com/sapioit/URL-shortener|URL-shortener]] -[[http://yourls.org/|YOURLS]] -[[https://github.com/thedevs-network/kutt|Kutt]] Cabe destacar que para que el acortador de URL fucione, necesita: - Tener un servidor GNU/Linux con una IP publica - Tener un dominio asociado con la ip publica, que para efectos del ejemplo se ha dejado como ''localhost'' o ''domain''. ====== URL-shortener ====== apt install git apache2 mariadb-server php libapache2-mod-php php7.0-mysql cd /var/www/ git clone https://github.com/sapioit/URL-shortener mysql mysql> create database url; mysql>CREATE user dnsurl@localhost IDENTIFIED by 'root'; mysql>GRANT ALL PRIVILEGES on url.* to dnsurl@localhost idenfied by 'root'; mysql>flush privileges; mysql -u dnsurl -p url nano /etc/apache2/sites-enabled/000-default.conf DocumentRoot /var/www/URL-shortener chown -R www-data:www-data /var/www/ systemctl restart apache2 nano URL-shortener/lib/db.php $db_connection = mysqli_connect( 'localhost', 'dnsurl', 'root', 'url') http://domain/ ====== YOURLS ====== apt install git apache2 mariadb-server php libapache2-mod-php php7.0-mysql cd /var/www/ git clone https://github.com/YOURLS/YOURLS cp YOURLS/user/config-sample.php YOURLS/user/config.php nano YOURLS/user/config.php define( 'YOURLS_DB_USER', 'dnsurl' ); define( 'YOURLS_DB_PASS', 'root' ); define( 'YOURLS_DB_NAME', 'yours' ); define( 'YOURLS_SITE', 'http://dnsurl.localhost.com' ); define( 'YOURLS_LANG', 'es' ); $yourls_user_passwords = array( 'usuario' => 'misuperclave', mysql mysql> create database yours; mysql>CREATE user dnsurl@localhost IDENTIFIED by 'root'; mysql>GRANT ALL PRIVILEGES on yours.* to dnsurl@localhost idenfied by 'root'; mysql>flush privileges; nano /etc/mysql/mariadb.conf.d/50-server.cnf ... [mysqld] innodb_file_format = Barracuda innodb_file_per_table = on innodb_default_row_format = dynamic innodb_large_prefix = 1 innodb_file_format_max = Barracuda ... systemctl restart mysql mysql -u dnsurl -p yours nano /etc/apache2/sites-enabled/000-default.conf DocumentRoot /var/www/YOURLS Options -Indexes FollowSymLinks AllowOverride All Require all granted chown -R www-data:www-data /var/www/ a2enmod rewrite systemctl restart apache2 nano /var/www/YOURLS/includes/functions-install.php ... '`keyword` varchar(600) BINARY NOT NULL,'. ... http://domain/admin/install.php ====== Kutt ====== apt install git apache2 postgresql redis-server exim4 nano /etc/postgresql/9.6/main/pg_hba.conf local all all md5 systemctl restart postgresql postgres=# create user dnsurl with encrypted password 'root'; postgres=# create database url with owner dnsurl; postgres=# alter user dnsurl with superuser; postgres=# \q psql -h localhost -U dnsurl -W -d url curl -sL https://deb.nodesource.com/setup_10.x -o nodesource_setup.sh bash nodesource_setup.sh apt-get install -y nodejs nodejs -v cd /var/www git clone https://github.com/thedevs-network/kutt cd kutt cp .example.env .env nano .env DEFAULT_DOMAIN="dnsurl.localhost.com" DB_HOST=localhost DB_PORT=5432 DB_NAME=url DB_USER=dnsurl DB_PASSWORD=root ... ADMIN_EMAILS=admin@gmail.com ... MAIL_HOST=localhost MAIL_PORT=25 MAIL_SECURE=false MAIL_USER=root MAIL_FROM=root MAIL_PASSWORD=pepe REPORT_EMAIL=root@localhost CONTACT_EMAIL=root@localhost ... a2enmod proxy a2enmod proxy_http a2enmod proxy_ajp a2enmod rewrite a2enmod deflate a2enmod headers a2enmod proxy_balancer a2enmod proxy_connect a2enmod proxy_html nano /etc/apache2/sites-enabled/000-default.conf DocumentRoot /var/www/html/ ProxyPreserveHost On ProxyPass / http://0.0.0.0:3000/ ProxyPassReverse / http://0.0.0.0:3000/ systemctl restart apache2 npm install npm run dev & # and register on the site psql postgres=# \c url postgres=# select * from users; postgres=# update users set verified=true where email='admin@gmail.com'; postgres=# update users set verification_expires=NULL where email='admin@gmail.com'; postgres=# \q #Login in kutt ====== Referencias ====== * https://github.com/awesome-selfhosted/awesome-selfhosted#url-shorteners * https://dba.stackexchange.com/questions/231219/mariadb-10-1-38-specified-key-was-too-long-max-key-length-is-767-bytes * https://www.digitalocean.com/community/tutorials/how-to-use-apache-http-server-as-reverse-proxy-using-mod_proxy-extension * https://linuxize.com/post/how-to-install-node-js-on-debian-10/ * https://aws.amazon.com/blogs/compute/build-a-serverless-private-url-shortener/