0. Prerequisites & Stack We’re Using
Component | Version |
---|---|
Ubuntu | 24.04 LTS (KVM-4 VPS, Hostinger) |
Web-server | Apache 2.4 |
DB | MariaDB 10.11 |
PHP | 8.3 (with FPM) |
SSL | Sectigo DV (valid → Feb 2026) |
Cache | Redis 7 + OPcache |
WP Theme | Woodmart |
Page-Builder | Elementor + CartFlows |
SSH in as root (or a sudo user) before running anything:
ssh root@YOUR_SERVER_IP
1. Essential Commands (do these first)
1.1 System update & common tools
apt update && apt upgrade -y
apt install unzip curl git htop -y
1.2 LAMP stack & PHP extras
apt install apache2 mariadb-server php php-{fpm,cli,common,mbstring,zip,gd,curl,xml,imagick,redis,mysql} -y
systemctl enable --now apache2 mariadb php8.3-fpm
1.3 Add Domain example.com.bd
Create a Virtual Host:
sudo mkdir -p /var/www/xemum.com.bd
sudo chown -R $USER:$USER /var/www/xemum.com.bd
Create the config:
<VirtualHost *:80>
ServerName xemum.com.bd
ServerAlias www.xemum.com.bd
DocumentRoot /var/www/xemum.com.bd
<Directory /var/www/xemum.com.bd>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/xemum_error.log
CustomLog ${APACHE_LOG_DIR}/xemum_access.log combined
</VirtualHost>
Enable it:
sudo a2ensite xemum.com.bd
sudo a2enmod rewrite
sudo systemctl reload apache2
1.4 SSL (already Sectigo)
# Copy your Sectigo CRT & CA bundle to /etc/ssl/certs/
nano /etc/apache2/sites-available/xemum.com.bd-le-ssl.conf # or create one
# -> set SSLCertificateFile /etc/ssl/certs/xemum.com.bd.crt
# -> set SSLCertificateChainFile /etc/ssl/certs/SectigoBundle.crt
systemctl reload apache2
Verify:
openssl s_client -connect xemum.com.bd:443 -servername xemum.com.bd \
</dev/null | openssl x509 -noout -issuer -dates
1.5 Secure MariaDB & make WordPress DB
mysql_secure_installation # set root-sql password, remove test DB
mysql -u root -p <<'SQL'
CREATE DATABASE xemumbd DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'xemumbd'@'localhost' IDENTIFIED BY 'Pass@12345';
GRANT ALL PRIVILEGES ON xemumbd.* TO 'xemumbd'@'localhost';
FLUSH PRIVILEGES;
SQL
1.6 PHPMyAdmin (optional GUI)
apt install phpmyadmin -y # choose Apache, then “dbconfig-common”, set phpmyadmin pwd
Access: https://xemum.com.bd/phpmyadmin/
1.7 Redis object cache
apt install redis-server php-redis -y
systemctl enable --now redis-server
redis-cli ping # returns PONG
1.8 Correct WordPress file ownership & FS method
cd /var/www/xemum.com.bd
chown -R www-data:www-data .
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
# ensure direct writes (no FTP prompt)
sed -i "/stop editing/i\define( 'FS_METHOD', 'direct' );" wp-config.php
2. Optional / Nice-to-Have Commands
Purpose | Command |
---|
Enable HTTP/2 | a2enmod http2 && echo 'Protocols h2 http/1.1' >/etc/apache2/conf-available/http2.conf && a2enconf http2 && systemctl reload apache2 |
Install WP-CLI | curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp |
Auto-renew Sectigo reminder (cron log) | `echo “0 4 1 2 * echo ‘Renew Sectigo SSL!’ |
Enable Brotli compression | apt install brotli -y && a2enmod brotli && systemctl reload apache2 |
3. Troubleshooting / Fix Commands
Symptom | Fix |
---|
Plugin update asks FTP | chown -R www-data:www-data /var/www/xemum.com.bd && add FS_METHOD 'direct' |
“uploads folder not writable” | chown -R www-data:www-data wp-content && find wp-content -type d -exec chmod 755 {} \; |
mysqli::real_connect() (HY000/1698) in phpMyAdmin | ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEWPWD'; FLUSH PRIVILEGES; then edit /etc/phpmyadmin/config.inc.php or remove controluser lines |
Redis fails enable alias | use systemctl enable redis-server (not redis ) |
Apache syntax error | apachectl configtest then journalctl -xe |
SSL mismatch | check vHost paths, then systemctl reload apache2 & openssl s_client ... |
Large DB import limit (phpMyAdmin 2 MiB) | Edit /etc/php/*/apache2/php.ini : |
upload_max_filesize = 128M & post_max_size = 128M , then systemctl reload apache2 |
4. Quick Reboot & Update Workflow
# install kernel patches
apt update && apt full-upgrade -y
reboot # disconnects PuTTY; reconnect after ~30 s
# after login
uptime # check fresh boot