Skip to content

ioeshu/Raspberry-Pi-Web-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

Turn Raspberry Pi Into Web Server

Project Image

This project helps you to turn your Raspberry Pi into a personal web server.


Table of Contents

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


Description

You can use google cloud or Amazon Aws to host your script but if you like building things this project for you.

RUN PHP SCRIPT / WORDPRESS ON RASPBERRY PI

  • Run Wordpress on Raspberry pi
  • Run PHP or Html script on Raspberry pi

How To

Run Wordpress on Raspberry pi

Installation

  • 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

Change directory to /var/www/html/ and delete all the files in the folder.

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 WordPress Database

  • 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; 

WordPress configuration

http://localhost

keep it like this

Database Name:      wordpress
User Name:          root
Password:           <YOUR PASSWORD>
Database Host:      localhost
Table Prefix:       wp_

Click Submit to proceed.

Click the Run the install button.

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

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"; ?>

Author Info

Back To The Top

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published