Migrating a WordPress site from a Raspberry Pi to a Proxmox VM can seem complicated, but with a structured approach, it becomes straightforward. This guide walks you through the process in a generalized way, without revealing any sensitive details such as usernames, passwords, or actual domain content.
Migrating a WordPress site from a Raspberry Pi to a Proxmox VM can seem complicated, but with a structured approach, it becomes straightforward. This guide walks you through the process in a generalized way, without revealing any sensitive details such as usernames, passwords, or actual domain content.
Step 1: Prepare the Raspberry Pi
- Stop Nginx and MySQL to prevent changes during backup.
- Backup WordPress files: tar.gz of the site folder.
- Export the WordPress database: mysqldump.
Step 2: Copy Files to Proxmox VM
- Use scp or rsync to transfer the WordPress files and database dump to the VM’s home directory.
Step 3: Prepare Proxmox VM
- Install a LEMP stack: Nginx, PHP-FPM, and MySQL.
- Check the PHP-FPM version and note the socket path.
Step 4: Restore WordPress Files
- Extract the tar.gz into /var/www/.
- Set proper ownership and permissions (www-data).
Step 5: Create Database and Import
- Create a MySQL database and user.
- Import the database dump, fixing collation issues if necessary.
Step 6: Configure Nginx
- Set up a site file pointing to the WordPress folder.
- Ensure the fastcgi_pass points to the correct PHP-FPM socket.
- Test Nginx configuration and reload.
Step 7: SSL Certificates (Optional)
- Copy existing Let’s Encrypt certificates or issue new ones.
- Update Nginx SSL paths if needed.
- Test Nginx to confirm SSL works.
Step 8: Test the Site
- Optionally update /etc/hosts to point the domain to the VM IP.
- Open the site in a browser and confirm WordPress is running.
- Re-save permalinks to ensure URLs work.
Step 9: Add Sample Blog Post
- Use the WordPress admin dashboard to create a new post.
- Title: “Full Walkthrough to Migrate a WordPress Site from a Raspberry Pi to a Proxmox VM”
- Content: This guide demonstrates how to migrate a WordPress site safely and efficiently, ensuring that files, database, Nginx configuration, and SSL certificates are all handled correctly.
By following this step-by-step approach, you can migrate WordPress safely and have a fully functional site on your Proxmox VM with minimal downtime.
Migrating a WordPress site from a Raspberry Pi to a Proxmox VM can seem complicated, but with a structured approach, it becomes straightforward. This guide walks you through the process in a generalized way, without revealing any sensitive details such as usernames, passwords, or actual domain content.
Step 1: Prepare the Raspberry Pi
Stop Nginx and MySQL to prevent changes during backup:
“`bash
sudo systemctl stop nginx
sudo systemctl stop mysql
Backup WordPress files:
cd /var/www/<wordpress-site-folder>
sudo tar czvf ~/wordpress-files.tar.gz .
Export the database:
mysqldump -u root -p <wordpress-db-name> > ~/wordpress-db.sql
Step 2: Copy Files to Proxmox VM
scp ~/wordpress-files.tar.gz user@<vm-ip>:~
scp ~/wordpress-db.sql user@<vm-ip>:~
Step 3: Prepare Proxmox VM
Install Nginx, PHP-FPM, and MySQL:
sudo apt update
sudo apt install nginx php-fpm mysql-server -y
Check PHP version and socket:
php -v
ls /var/run/php/
Step 4: Restore WordPress Files
sudo mkdir -p /var/www/<wordpress-site-folder>
sudo tar xzvf ~/wordpress-files.tar.gz -C /var/www/<wordpress-site-folder>
sudo chown -R www-data:www-data /var/www/<wordpress-site-folder>
sudo chmod -R 755 /var/www/<wordpress-site-folder>
Step 5: Create Database and Import
Create database and user:
CREATE DATABASE <wordpress-db-name>;
CREATE USER '<wp-user>'@'localhost' IDENTIFIED BY '<password>';
GRANT ALL PRIVILEGES ON <wordpress-db-name>.* TO '<wp-user>'@'localhost';
FLUSH PRIVILEGES;
Import the database:
mysql -u <wp-user> -p <wordpress-db-name> < ~/wordpress-db.sql
If collation errors occur:
sed 's/utf8mb4_uca1400_ai_ci/utf8mb4_unicode_ci/g' ~/wordpress-db.sql > ~/wordpress-db-fixed.sql
mysql -u <wp-user> -p <wordpress-db-name> < ~/wordpress-db-fixed.sql
Step 6: Configure Nginx
Edit /etc/nginx/sites-available/<wordpress-site>:
server {
listen 80;
server_name <domain> www.<domain>;
root /var/www/<wordpress-site-folder>;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/<php-fpm-socket>;
}
location ~ /\.ht {
deny all;
}
}
Enable and test:
sudo ln -s /etc/nginx/sites-available/<wordpress-site> /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
Step 7: SSL Certificates (Optional)
Copy existing certificates:
sudo rsync -avz /etc/letsencrypt/ user@<vm-ip>:/tmp/letsencrypt-backup/
On VM:
sudo rsync -avz /tmp/letsencrypt-backup/ /etc/letsencrypt/
sudo chown -R root:root /etc/letsencrypt
sudo chmod -R 755 /etc/letsencrypt
Update Nginx paths:
ssl_certificate /etc/letsencrypt/live/<domain>/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<domain>/privkey.pem;
Test:
sudo nginx -t
sudo systemctl reload nginx
Step 8: Test the Site
Optionally update /etc/hosts locally:
<vm-ip> <domain> www.<domain>
Visit in browser and confirm the site is running.
Resave permalinks: Settings → Permalinks → Save Changes.
Step 9: Add Sample Blog Post
Using WordPress Admin:
- Title: Full Walkthrough to Migrate a WordPress Site from a Raspberry Pi to a Proxmox VM
- Content: This guide demonstrates how to migrate a WordPress site safely and efficiently, ensuring that files, database, Nginx configuration, and SSL certificates are all handled correctly.
Or via SQL:
INSERT INTO wp_posts
(post_author, post_date, post_date_gmt, post_content, post_title, post_status, post_type)
VALUES
(1, NOW(), NOW(), 'This guide demonstrates how to migrate a WordPress site safely and efficiently, ensuring that files, database, Nginx configuration, and SSL certificates are all handled correctly.', 'Full Walkthrough to Migrate a WordPress Site from a Raspberry Pi to a Proxmox VM', 'publish', 'post');
✅ Following these steps, you will have a fully migrated WordPress site on your Proxmox VM with a sample post ready to display. All critical files, database, Nginx config, and SSL are handled securely and without exposing sensitive information.
---
If you want, I can also **turn this into a ready-to-run shell + SQL script** that will:
- Copy files from Pi → VM
- Restore database
- Configure Nginx + SSL
- Add this blog post automatically
Do you want me to make that script?