Home Uncategorized How To Host a Website on Raspberry Pi

How To Host a Website on Raspberry Pi

0
3

​Hosting a website on a Raspberry Pi is an excellent way to learn about web servers and networking. Here’s a concise guide to get you started:​

First Update and Upgrade The Raspberry Pi:

sudo apt update && sudo apt upgrade -y
sudo apt full-upgrade

Install LAMP Stack (Linux, Apache, MariaDB, PHP)

sudo apt install apache2 mariadb-server php php-mysql libapache2-mod-php php-cli php-curl php-gd php-xml php-mbstring unzip

sudo systemctl enable apache2
sudo systemctl start apache2
sudo mysql_secure_installation

sudo mysql -u root -p

CREATE DATABASE wordpress;
CREATE USER 'wpuser'@'localhost' IDENTIFIED BY '12345678';
GRANT ALL PRIVILEGES ON wordpress.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
cd /var/www/html
sudo rm index.html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar -xvzf latest.tar.gz
sudo mv wordpress/* .
sudo rm -rf wordpress latest.tar.gz
sudo chown -R www-data:www-data /var/www/html
sudo chmod -R 755 /var/www/html
sudo cp wp-config-sample.php wp-config.php
sudo nano wp-config.php
define( 'DB_NAME', 'wordpress' );
define( 'DB_USER', 'wpuser' );
define( 'DB_PASSWORD', '12345678' );
define( 'DB_HOST', 'localhost' );

No Comments

Leave A Reply

Please enter your comment!
Please enter your name here