Search This Blog

Setting up Apache on a Raspberry Pi

I recently covered how to set up nginx on a Raspberry Pi and also how to use PHP with nginx on a Raspberry Pi. For those of you that would prefer to use Apache on your Pi, here is how you can get it set up and configured.
First, install Apache by entering this command into a terminal on or connected to the Raspberry Pi:
sudo apt-get install apache2
You can also check for other running web servers with this command:
ps -Alf | grep www
That shows lines like 00:00:00 nginx: worker process for my Pi, so I'm going to stop nginx (sudo /etc/init.d/nginx stop).
Now that Apache is installed, you can visit your Pi's local IP address to make sure it's working. Apache is automatically started, and when I visit (my Pi's IP, found by using the ifconfig command) I see a page that says "It works!".
Next, you can edit that default page on your Pi by opening and editing /var/www/index.html. That's all there is to it, Apache is now installed and running on your Raspberrry Pi!