by

Installing Apache2 On Raspberry Pi

Installing Apache2 On Raspberry Pi 4,8/5 6120 votes

Tomcat 7 with Java 8 on Raspberry Pi. Installing Apache Tomcat 8 on a Raspberry Pi. On my Raspberry Pi I have already installed Apache 2 HTTP server and hence this article does a basic install and configuration of Tomcat. Firstly, update all installed packages. Learn to create and using Apache web server in Raspberry Pi. Apache is one of the most popular web server application used in Raspberry Pi to server web pages. Apache is able to serve HTML files over an HTTP connection.

  1. Installing Apache On Raspberry Pi 3
  2. Raspberry Pi Apache2 Config
  3. Install Apache2 On Raspberry Pi
  • How to set up a web server on the Raspberry Pi To run our web server, we’re using what’s commonly called the LEMP stack: Linux, nginx, MySQL, and PHP. In short, LEMP uses Linux as the operating system on the device hosting the server, nginx as the server itself, MySQL as a database management system, and PHP for dynamic processing.
  • I never installed apache on a Pi but on debian (raspbian is based on debian) the config file is apache2.conf (not httpd.conf); it should be in /etc/apache2.

In this guide, I show you how to install LAMP stack on Raspberry Pi 3 or Raspberry Pi 0. We do this for the purpose of creating a web server with WordPress-hosting capabilities!

Difficulty Level: Beginner to Intermediate

Time to Complete: 45 mins to 1 hour

Warning: Your information is exposed.
Your location is .
Your IP address is 88.99.2.89.
Hide Me Now

What you need:Raspberry Pi 3 or Raspberry Pi 0 ($37 on Amazon) with Internet access

Get a Raspberry Pi 3 to and install LAMP stack on it so you can use RPi as a WordPress server!

What is a LAMP Stack?

Since a LAMP stack is essentially just the components of a powerful web server, we can host a WordPress site (or any other website) right from our Raspberry Pi.

Cool, huh?

I think so – especially because it means I can use a Raspberry Pi as a dedicated WordPress site development area (or “WordPress sandbox“).

What is This “Sandbox Web Server” Business All About Anyway?

In this tutorial, I use the free “Raspbian with PIXEL” operating system to quickly and easily set up a robust (WordPress-capable!) web server. This means you can create a WordPress site and host it right on your Raspberry Pi.

Can I Use This to Host a LIVE Website That’s Open to the World?

Hosting the site on your Raspberry Pi for the world isn’t very realistic. It’s definitely possible – just not very practical for most people.

Installing apache2 on raspberry pie

But what is realistic is the fact that you can use the LAMP stack on Raspberry Pi as a WordPress “sandbox”.

What is a WordPress Sandbox?

Basically a WordPress sandbox is a “dummy” WordPress site in which you can tinker and play around with WordPress, or use as what web designers call a “development site”, or “dev site”.

Or if you’re serious (like me), you can build an entire WordPress site on your Raspberry Pi – then export it using a free WordPress “Clone” Plugin to easily “migrate” the WordPress site to a live, public web host.

Google trackers are lurking on 75% of websites. Cover your tracks to protect yourself.

How to Install LAMP Stack on Raspberry Pi (Raspbian)

  1. Install Raspbian using NOOBS and boot up the Raspberry Pi 3 into Raspbian.
  2. Open a Terminal window (Press Ctrl+Alt+T on your USB keyboard)
  3. Enter “sudo apt-get update -y“. Then wait until it’s done. This step fetches the list of software updates available for Raspbian on Raspberry Pi 3.
  4. Now enter “sudo apt-get upgrade -y“. Wait until it’s all done. In this step, Raspbian actually upgrades all the programs on your Raspbian operating system. This process takes my Raspberry Pi 3 around 30 minutes, so you need to be patient and let it finish.
  5. Then, we install Apache by entering this command: “sudo apt-get install apache2 -y“. Wait for Apache web server Raspberry Pi edition to install.
  6. When Apache is done installing, launch the web browser on your Raspberry Pi. Installing Apache in Raspbian took my RPi 3 about three minutes.
  7. Then enter http://localhost/ into the web browser’s address bar. This should display a page called “Apache2 Debian Default Page”.

    Apache web server Raspberry Pi successfully installed

  8. Now go back to the Terminal window (or re-open it using Ctrl+Alt+T).
  9. From the Terminal, install PHP on Raspberry Pi quickly by entering “sudo apt-get install php5 libapache2-mod-php5 -y” into the Terminal window. Wait for PHP to install – it took my RPi 3 about two minutes.
  10. Now in the Terminal, enter “cd /var/www/html“. This command takes us into the folder where our website lives. Any files you put in this folder will be “public” and served by your web server.
  11. Then in the Terminal, enter “sudo idle index.php“. This opens the “IDLE” GUI-based text editor app and creates a file which we use (“index.php”) in the next step to test the PHP installation we just installed.
  12. After IDLE launches, enter this: “<?php echo ‘hello world’; ?>“. Then Save the File and Close the IDLE text editor. You should now be back at the Terminal.
  13. In the Terminal, finally enter “sudo rm index.html” to make sure the PHP test file you created shows up, instead of the default (HTML) file.
  14. Now launch your browser and enter http://localhost/ into the address bar. You should see “hello world”! If you do, this means PHP is installed properly, you’re doing great, and you’re almost done installing LAMP stack on Raspberry Pi!
  15. Go back to the Terminal. It’s time to install MySQL. Enter “sudo apt-get install mysql-server php5-mysql -y” to install MySQL on Raspberry Pi. As MySQL installs, it will bring up a (blue) screen that asks for a “root” password. Enter a password that you’re sure you can remember and hit Enter. Or just use the default Raspberry Pi password, which is “raspberry” (as long as you don’t plan to make this a public-facing web server). The MySQL installer will then ask you to re-enter your newly-chosen MySQL password. Then MySQL will continue installing. It took about 5 minutes after asking for my root password to finish the installation.
  16. After MySQL is installed, restart Apache web server by entering “sudo service apache2 restart” into the Terminal. You’re done with the install LAMP stack on Raspberry Pi process! Keep reading to install WordPress on your new LAMP stack web server.

After you follow the steps above to install LAMP stack on Raspberry Pi, use the steps below to install WordPress on your new, full-fledged, mighty little Raspberry Pi web server!

How to Install WordPress after you install LAMP Stack on Raspberry Pi

  1. From the Terminal, enter “cd /var/www/html/“. Then enter “sudo rm *“. These two commands take us into the “public-facing” folder in our webserver and deletes all files in that location.
  2. Now enter “sudo wget http://wordpress.org/latest.tar.gz“. This command downloads WordPress!
  3. In the Terminal, enter this command to extract the WordPress “zip” file you just downloaded: “sudo tar xzf latest.tar.gz”
  4. Then enter this command to move the extracted folder into the right place: “sudo mv wordpress/* .
  5. Finally, enter “sudo rm -rf wordpress latest.tar.gz” to remove the zip file (now that we’re done with it).
  6. To test the WordPress installation, launch your browser and enter “http://localhost” in the address bar. You should now see the “Welcome to WordPress” screen.
  7. Now enter the two commands “sudo chown -R www-data:www-data /var/www/html/” and “sudo chmod -R 755 /var/www/html/” to give WordPress proper access to the files it needs. Without this step, you won’t be able to install WordPress Plugins!
  8. Then, from the Terminal enter “mysql -u root -p“. Then enter your password. The default password for Raspbian is “raspberry”.
  9. Now that you’re in the “MySQL shell”, enter “CREATE DATABASE wp_myblog;“. Then enter “GRANT ALL PRIVILEGES ON wp_myblog.* TO ‘myusername‘@’localhost’ IDENTIFIED BY ‘mypassword‘;“. Finally, enter “FLUSH PRIVILEGES;” and then “EXIT;”.
  10. Now that you’re back at the Terminal, enter “sudo mv wp-config-sample.php wp-config.php“.
  11. Then enter “sudo idle wp-config.php“. This opens the Text Editor.
  12. Using the text editor, change the “password_here”, “username_here”, and “database_name_here” fields to “mypassword“, “myusername“, and “wp_myblog” (respectively). Then Save the File and exit the IDLE text editor.
  13. Now launch your web browser and enter “http://localhost/” into the browser address bar.
  14. The Wordrpess website setup screen appears! Enter a site title, enter a username and a password and email address, and click Install WordPress.
  15. After WordPress finishes installing, you will see the word “Success!” on your screen. Then click “Log In” to log in to your new WordPress site!
  16. Finally, enter the username and password you chose at the WordPress setup screen and click “Log In” to reach the WordPress dashboard.

Apache Web Server Raspberry Pi Notes

  • The LAMP stack runs 67% of the entire world’s web servers. So, LAMP is the most popular web server platform in the world. Why? It has a combination of performance and scalability that is matched by no other webserver platform.
  • There is a big difference between WordPress.com and WordPress.org:
    • WordPress.com is a site that severely restricts your capabilities as a WordPress administrator. In exchange, they host your WordPress site for you on their servers (so you don’t have to buy your own web hosting account).
    • On the other hand, a WordPress.org website is a website that uses the WordPress.org Content Management System. This system is way better than the WordPress.com Content Management System (or “CMS”). Why? Because WordPress.org does not limit your WordPress administrator capabilities at all. You can do anything: install plugins, install WordPress themes, etc.
  • Use this command to Restart Apache Web server on Raspberry Pi: “sudo service apache2 restart”
  • To see info about the PHP version you have installed, put this into the “index.php” file we created in the steps at the top of this page: “<?php phpinfo(); ?>
  • For a full install LAMP on Ubuntu 16.04 guide, check out this awesome tutorial.
  • Adafruit has a great tutorial on how to autostart Raspbian VNC server on Raspberry Pi boot-up, so you can remote control your Pi from just about any other device with a VNC viewer!
LAMP Stack
Operating System
Internet
Price

Apache is a popular web server application you can install on the Raspberry Pi to allow it to serve web pages.

On its own, Apache can serve HTML files over HTTP, and with additional modules can serve dynamic web pages using scripting languages such as PHP.

Install Apache

First, update the available packages by typing the following command into the Terminal:

Then, install the apache2 package with this command:

Test the web server

By default, Apache puts a test HTML file in the web folder. This default web page is served when you browse to http://localhost/ on the Pi itself, or http://192.168.1.10 (whatever the Pi's IP address is) from another computer on the network. To find the Pi's IP address, type hostname -I at the command line (or read more about finding your IP address).

98 02 FORD ESCORT FUEL PUMP DRIVER MODULE XS4F9D372BB 0 results. You may also like. 1998 Ford Escort / where the fuel pump driver. Where the fuel pump driver module is located (1998 Ford Escort) part time dead in Potwin, KS on. June 28, 2014. Have low voltage at fuel pump. Sign in to Answer. Like this comment? Sign in or register to let us know! Register Sign In (0). Find great deals on eBay for ford fuel pump driver module. Shop with confidence. Skip to main content. New Fuel Pump Driver Module for Ford F-150 F-350 Lobo Expedition 4C2A9D372BA See more like this. Electrical Fuel Pump Driver Module for Ford F-150 F-250 Expedition 5.4L 590-001 (Fits: Ford). Ford escort fuel pump driver module.

Browse to the default web page either on the Pi or from another computer on the network and you should see the following:

Installing Apache On Raspberry Pi 3

This means you have Apache working!

Changing the default web page

This default web page is just an HTML file on the filesystem. It is located at /var/www/html/index.html.

Navigate to this directory in a terminal window and have a look at what's inside:

This will show you:

This shows that by default there is one file in /var/www/html/ called index.htmland it is owned by the root user (as is the enclosing folder). In order to edit the file, you need to change its ownership to your own username. Change the owner of the file (the default pi user is assumed here) using sudo chown pi: index.html.

You can now try editing this file and then refreshing the browser to see the web page change.

Your own website

If you know HTML you can put your own HTML files and other assets in this directory and serve them as a website on your local network.

Additional - install PHP

To allow your Apache server to process PHP files, you'll need to install the latest version of PHP and the PHP module for Apache. Type the following command to install these:

Now remove the index.html file:

and create the file index.php:

Raspberry Pi Apache2 Config

Note: Leafpad is a graphical editor. Alternatively, use nano if you're restricted to the command line

Put some PHP content in it:

Now save and refresh your browser. You should see 'hello world'. This is not dynamic but still served by PHP. Try something dynamic:

or show your PHP info:

Further - WordPress

Install Apache2 On Raspberry Pi

Now you have Apache and PHP installed you can progress to setting up a WordPress site on your Pi. Continue to WordPress usage.