---
# System prepended metadata

title: Raspberry Pi webserver cheatsheet - using Apache2
tags: [' raspberrypi', cheatsheet, ' web']

---

---
tags: cheatsheet, web, raspberrypi
---
# Raspberry Pi webserver cheatsheet - using Apache2

## Setup
### Installing apache2
```
sudo apt-get apache2
```

### Check default path exists
```
ls /var/www/html/
```

### Check if apache is runnung
```
ps aux | grep apache
```
You should get something like:
```
root       584  0.0  0.4   7308  4412 ?        Ss   Dec12   0:24 /usr/sbin/apache2 -k start
www-data 17162  0.0  0.6 236888  5868 ?        Sl   00:00   0:01 /usr/sbin/apache2 -k start
www-data 17163  0.0  0.6 236856  6136 ?        Sl   00:00   0:03 /usr/sbin/apache2 -k start
pi       18496  0.0  0.0   2736   548 pts/0    S+   07:08   0:00 grep --color=auto apache
```
If not, start is manaually
```
sudo service apache2 start
```

### Test your site
Go to following address using your browser
```
http://[your-raspberry-pi-ip-address]
```
If you see this page, the apache server is properly installed and ready to use.

![](https://i.stack.imgur.com/Cgr5L.png)


## Virtual network
If you host your rpi under pppoe, it will have an dynamic external ip address, in order to solve this problem, the simplest way is to create a virtual network.
==**NOTE** THIS WILL LIMIT YOUR SERVER ACCESS SINCE ONLY CLIENTS UNDER THE SAME VIRTUAL NETWORK CAN CONNECT TO THE RPI==

### intalling hamachi
since hamachi is free to use(5 users max per virtual network) I am using it.
```
wget https://www.vpn.net/installers/logmein-hamachi_2.1.0.203-1_armhf.deb
sudo dpkg -i logmein-hamachi_2.1.0.203-1_armhf.deb
```
### Using hamachi
checking hamachi status
```
sudo hamachi
```
checking hamachi network status
```
sudo hamachi list
```
create network
```
sudo hamachi create <network-id> <password-for-the-network>
```
join network
```
sudo hamachi join <network-id> <password-for-the-network>
```
leave network
```
sudo hamachi leave <network-id>
```