How to Install WordPress on InterServer VPS – All Commands

Run these commands one by one to install wordpress on InterServer VPS hosting.

apt install mariadb-server mariadb-client -y
systemctl enable --now mariadb
mysql_secure_installation
mysql -u root -p

You can change the demo password Admin123 to secure your website.

CREATE DATABASE wp_db DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'wp_user'@'localhost' IDENTIFIED BY 'Admin123';
GRANT ALL PRIVILEGES ON wp_db.* TO 'wp_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
apt install php-fpm php-mysql php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip -y
cd /tmp
wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
rm -rf /var/www/html/*
cp -r /tmp/wordpress/* /var/www/html/
chown -R www-data:www-data /var/www/html/
chmod -R 755 /var/www/html/
nano /etc/nginx/sites-available/default

After opening the file, remove all the existing codes using backspace or Alt+backspace (faster). Then copy and paste the below codes. Here keep mind to change the domain name according to yours.

server {
    listen 80;
    listen [::]:80;
    server_name yourdomain.com www.yourdomain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name yourdomain.com www.yourdomain.com;

    root /var/www/html;
    index index.php index.html index.htm;

    # SSL Certbot Location
    ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php-fpm.sock;
    }

    location ~ /\.ht {
        deny all;
    }
}
nginx -t
systemctl reload nginx

Finally, setup your database details like below. Input your strong password.

Database Name: wp_db
Username: wp_user
Password: YourStrongPassword
Database Host: localhost

Leave a Comment