Welcome to VPS basic installation setup guide.
This will update and upgrade existing librarys and applications of Ubuntu (LTS)
apt update && apt upgrade -yNginx is a web server that can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache. The software was created by Russian developer Igor Sysoev and publicly released in 2004. Nginx is free and open-source software, released under the terms of the 2-clause BSD license.
apt install nginx -yMySQL is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My and "SQL", the acronym for Structured Query Language. A relational database organizes data into one or more data tables in which data may be related to each other; these relations help structure the data.
apt install mysql-server -yPHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993 and released in 1995. The PHP reference implementation is now produced by the PHP Group. PHP was originally an abbreviation of Personal Home Page, but it now stands for the recursive backronym PHP: Hypertext Preprocessor.
apt install php php-fpm php-mysql php-cli php-mbstring php-xml php-curl php-zip php-bcmath php-intl php-gd php-json php-tokenizer php-common -yUnzip – Extracts compressed .zip files.
apt install unzip -yGit – Version control system for tracking code changes.
apt install git -yCurl – Transfers data from or to a server via command line.
apt install curl -yUFW – Simplifies firewall management in Linux.
apt install ufw -yComposer – Dependency manager for PHP projects.
apt install composer -yAfter installing MySQL, you should secure your database by setting a strong root password, running the security script, and creating a new database user.
mysqlThis command changes the root user’s password using the secure caching_sha2_password authentication method.
ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'your_strong_password';
exitThis script helps improve database security by removing test databases, anonymous users, and disabling remote root login.
mysql_secure_installationLog back into MySQL and create a new user with a secure password.
mysql -u root -p
CREATE USER 'user_name'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'your_strong_password';
exitBy default apache2 is the default webserver. You need to disable it to avoide conflict with Nginx.
systemctl status apache2If runing
systemctl stop apache2
systemctl disable apache2service nginx statusIf deactive
nginx -t
service nginx start
service nginx restartphpMyAdmin is a free and open-source administration tool for managing MySQL and MariaDB through a web interface. It allows you to perform database operations such as creating, modifying, and deleting databases, tables, and users easily.
apt install phpmyadmin -yAfter installation, configure Nginx to serve phpMyAdmin on a dedicated subdomain.
nano /etc/nginx/sites-available/subdomain_for_phpmyadmin.yourdomain.comPaste the following configuration:
server {
listen 80;
server_name subdomain_for_phpmyadmin.yourdomain.com;
root /usr/share/phpmyadmin;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}Enable the configuration and reload Nginx:
ln -s /etc/nginx/sites-available/subdomain_for_phpmyadmin.yourdomain.com /etc/nginx/sites-enabled/
nginx -t && systemctl reload nginxUse Let’s Encrypt to enable HTTPS. It's completly free.
apt install -y certbot python3-certbot-nginxGet a certificate for your domain
certbot --nginx -d subdomain_for_phpmyadmin.yourdomain.comIf all goes fine, your phpMyAdmin database should now be live at: 👉 https://subdomain_for_phpmyadmin.yourdomain.com
I’m a passionate web developer with experience in building scalable and secure applications. I specialize in Laravel, Django, JavaScript and server management with Nginx. I enjoy automating workflows, optimizing performance, and deploying modern web solutions on VPS environments. I believe in clean code, continuous learning, and sharing knowledge through open-source contributions.