This project helps you to turn your Raspberry Pi into a personal web server.
After your personal web server is complete, you can use it to host a custom HTML or PHP resume, or a wordpress site on your Raspberry pi
You can use google cloud or Amazon Aws to host your script but if you like building things this project for you.
- Run Wordpress on Raspberry pi
- Run PHP or Html script on Raspberry pi
- Install Apache
sudo apt-get install apache2 -y
- Install PHP
sudo apt install php libapache2-mod-php -y
- Install MariaDB
sudo apt-get install mariadb-server php-mysql -y
sudo service apache2 restart
- Download WordPress
cd /var/www/html/
sudo rm *
Download WordPress using wget.
sudo wget http://wordpress.org/latest.tar.gz
Extract, Move , remove tarball
sudo tar xzf latest.tar.gz
sudo mv wordpress/* .
sudo rm -rf wordpress latest.tar.gz
change the ownership of all these files to the Apache user:
sudo chown -R www-data: .
- Set up MySQL/MariaDB
sudo mysql_secure_installation
- Create the WordPress database
sudo mysql -uroot -p
create database wordpress;
If this has been successful, you should see this: Query OK, 1 row affected (0.00 sec)
Now grant database privileges to the root user. Note: you will need to enter your own password after IDENTIFIED BY
.
GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'ENTER-YOUR-PASSWORD';
For the changes to take effect, you will need to flush the database privileges after that exit Ctrl + D.
and then reboot
FLUSH PRIVILEGES;
http://localhost
keep it like this
Database Name: wordpress
User Name: root
Password: <YOUR PASSWORD>
Database Host: localhost
Table Prefix: wp_
- Install Apache
sudo apt-get install apache2 -y
- Install PHP
sudo apt install php libapache2-mod-php -y
Test the web server
http://localhost/ or http://Enter your ip address
you will see a default web page is just an HTML file on the filesystem. It is located at
/var/www/html/index.html
Navigate to this directory, remove the file and create a new php file
cd /var/www/html
sudo rm index.html
sudo nano index.php
paste and click Ctrl+ O
<?php echo "hello world"; ?>