Install Sportener URL Cutting in Nat VPS


Natvps.id – Kutt is a service Shortening URL Modern and Open-source Which allows users to shorten the long url into a short link, manage the link, and see statistics. KUTT supports the use of custom domains, allows user management, and can be self-host.

This article discusses the steps to install Kutt on NAT VPS using a docker, along with the Nginx configuration for Reverse-Proxy. This article uses Ubuntu 22.04 as a reference, but you can use other distributions such as Debian and Centos. Make sure the OS used supports the docker.

Port forwarding configuration

Considering we use grout, we need to add 2 Port Forwarding Configuration on the virtualizor panel (or other VPS panels according to the provider), namely Port Forwarding HTTP and HTTPS For the Kutt domain.

For example, in this article will use a domain Kutt.tutorial.mdinata.my.id To access KUTT. You are free to change the domain according to your choice. Record this port and domain, because we will use it again in the installation process.

Don’t forget to add DNS Records to go to your NAT VPS public IP, like this:

If confused, please read our article about Domain prosecution Here: Explanation of Domain Forwarding in NAT VPS.

Install Docker

We will use a docker and compile a docker for spread Cut.

First, install curly Using Orders:

apt update && apt install curl -y

Then, run manuscript Automatic installation from the docker by entering:

curl -fsSL get.docker.com | sh

Wait until the installation process is complete.

Install

First, Kutt’s clone repository.

git clone  --depth 1 /opt/kutt
cd /opt/kutt

Copy configuration .env First before starting KUTT:

apt install nano -y # Jika belum
cp .example.env .env
nano .env

Some configurations that need attention:

  • JWT_SECRET: Private key along> = 32 characters for authentication. To make it, enter the command pwgen -s 40 1. Must be filled in.
  • DEFAULT_DOMAIN: Your server address. Adjust to your domain, for example: Kutt.tutorial.mdinata.my.id
# Optional - App port to run on
PORT=3000

# Optional - The name of the site where Kutt is hosted
SITE_NAME=Kutt

# Optional - The domain that this website is on
DEFAULT_DOMAIN=kutt.tutorial.mdinata.my.id

# Required - A passphrase to encrypt JWT. Use a random long string
JWT_SECRET=

# Optional - Database client. Available clients for the supported databases:
# pg | better-sqlite3 | mysql2
# other supported drivers that you can use but you have to manually install them with npm:
# pg-native | sqlite3 | mysql
DB_CLIENT=better-sqlite3

# Optional - SQLite database file path
# Only if you're using SQLite
DB_FILENAME=db/data

# Optional - SQL database credential details
# Only if you're using Postgres or MySQL
DB_HOST=localhost
DB_PORT=5432
DB_NAME=kutt
DB_USER=postgres
DB_PASSWORD=
DB_SSL=false
DB_POOL_MIN=0
DB_POOL_MAX=10

# Optional - Generated link length
LINK_LENGTH=6

# Optional - Alphabet used to generate custom addresses
# Default value omits o, O, 0, i, I, l, 1, and j to avoid confusion when reading the URL
LINK_CUSTOM_ALPHABET=abcdefghkmnpqrstuvwxyzABCDEFGHKLMNPQRSTUVWXYZ23456789

# Optional - Tells the app that it's running behind a proxy server
# and that it should get the IP address from that proxy server
# if you're not using a proxy server then set this to false, otherwise users can override their IP address
TRUST_PROXY=true

# Optional - Redis host and port
REDIS_ENABLED=false
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=
# The number for Redis database, between 0 and 15. Defaults to 0.
# If you don't know what this is, then you probably don't need to change it.
REDIS_DB=0

# Optional - Disable registration. Default is true.
DISALLOW_REGISTRATION=true

# Optional - Disable anonymous link creation. Default is true.
DISALLOW_ANONYMOUS_LINKS=true

# Optional - This would be shown to the user on the settings page
# It's only for display purposes and has no other use
SERVER_IP_ADDRESS=
SERVER_CNAME_ADDRESS=

# Optional - Use HTTPS for links with custom domain
# It's on you to generate SSL certificates for those domains manually, at least on this version for now
CUSTOM_DOMAIN_USE_HTTPS=false

# Optional - Email is used to verify or change email address, reset password, and send reports.
# If it's disabled, all the above functionality would be disabled as well.
# MAIL_FROM example: "Kutt <[email protected]>". Leave it empty to use MAIL_USER.
# More info on the configuration on 
MAIL_ENABLED=false
MAIL_HOST=
MAIL_PORT=587
MAIL_SECURE=true
MAIL_USER=
MAIL_FROM=
MAIL_PASSWORD=

# Optional - Enable rate limitting for some API routes
ENABLE_RATE_LIMIT=false

# Optional - The email address that will receive submitted reports
REPORT_EMAIL=

# Optional - Support email to show on the app
CONTACT_EMAIL=

Save the file with Ctrl-X, yThen Enter.

Finally, run Kutt:

docker compose up -d

Wait until the process spread finished. Deploy can first take a few minutes because it has to download all picture Kutt and configure receptacle from the beginning.

Nginx Configuration (Reverse Proxy)

So that we can access the URL through a domain like Kutt.tutorial.mdinata.my.idwe can use Reverse Proxy Like Nginx.

First, install Nginx through the command:

# Hapus Apache2 dan pendukungnya (biasanya terpasang secara bawaan di VPS OpenVZ)
apt purge apache2* -y

# Install NGINX
apt install nginx -y

Create a new host configuration specifically for KUTT:

nano /etc/nginx/sites-available/kutt

Then stick the following configuration:

# 

proxy_cache_path /root/.nginxcache levels=1:2 keys_zone=my_cache:10m max_size=10g 
inactive=60m use_temp_path=off;
server {
        server_name kutt.tutorial.mdinata.my.id;
        listen 80;
        listen [::]:80;

	location / {
		proxy_cache my_cache;
		proxy_cache_revalidate on;
		proxy_cache_min_uses 3;
		proxy_cache_background_update on;
		proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
		proxy_cache_lock on;
		proxy_pass 
		proxy_http_version 1.1;
	}

	location /api/url/sharex {
		proxy_pass        
		proxy_redirect    off;
		proxy_set_header  Upgrade $http_upgrade;
		proxy_set_header  Connection "upgrade";
		proxy_set_header  Host $host;
		proxy_set_header  X-Real-IP $remote_addr;
		proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
		proxy_set_header  X-Forwarded-Proto $scheme;
		proxy_set_header Content-Type application/json;
		proxy_set_body $http_target;
	}
}

Change kutt.tutorial.mdinata.my.id with your domain.

Activate the configuration with:

ln -sf /etc/nginx/sites-available/kutt /etc/nginx/sites-enabled/kutt

systemctl restart nginx # Restart NGINX

Produce SSL certificate (let’s encryption)

So that our domain can be accessed through HTTPS, we need to make a SSL certificate. We can use a free SSL certificate from Let’s Encrypt through Certbot.

Install Certbot and Nginx plugin use the command:

apt install python3-certbot python3-certbot-nginx

So, produce Certificate through Certbot with the command

certbot --nginx -d kutt.tutorial.mdinata.my.id

Change kutt.tutorial.mdinata.my.id with your domain.

Happy! Your current domain can be accessed via a safe connection https.

Access Kutt

KUTT can be accessed through your previous domain. Example: https://kutt.tutorial.mdinata.my.id.

Create an account Admin to log in for the first time.

Congratulations, Kutt is ready to use!

Cover

Thus this article is about the steps to install Kutt on NAT VPS. If you are confused or doubtful, don’t hesitate to ask questions in the telegram group @ipv6indonesia. Thank You!


News
Berita
News Flash
Blog
Technology
Sports
Sport
Football
Tips
Finance
Berita Terkini
Berita Terbaru
Berita Kekinian
News
Berita Terkini
Olahraga
Pasang Internet Myrepublic
Jasa Import China
Jasa Import Door to Door