# Migrating Pi-Hole from lighttpd to apache

**URL:** https://discourse.pi-hole.net/t/migrating-pi-hole-from-lighttpd-to-apache/152
**Category:** Customizing Pi-hole
**Created:** [August 12, 2016, 12:37pm UTC](https://discourse.pi-hole.net/t/migrating-pi-hole-from-lighttpd-to-apache/152 "2016-08-12T12:37:14Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![rapi3](https://discourse-cdn.pi-hole.net/letter_avatar_proxy/v4/letter/r/c77e96/32.png) [@rapi3](https://discourse.pi-hole.net/u/rapi3)
#### Post date: [March 18, 2017, 3:45pm UTC](https://discourse.pi-hole.net/t/migrating-pi-hole-from-lighttpd-to-apache/152/14 "2017-03-18T15:45:32Z")

</div>

I just installed pihole on ubuntu server and because I already use Apache & PHP I uninstalled lighttpd.  
I have several virtual sites on Apache so I added also pihole; all work without problems.

## Here it is my config if anybody need to replicate for his use: **edit: /etc/apache2/sites-available/000-default.conf**

```
#=== pihole WEBSITE ===

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName pihole
        ServerAlias pi.hole

        DocumentRoot /var/www/html/dns
        <Directory /var/www/html/dns/>
                Options FollowSymLinks MultiViews
                AllowOverride all
                Order deny,allow
                allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/pihole_error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/pihole_access.log combined
</VirtualHost>

#=== site1 WEBSITE ===

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName site1

        DocumentRoot /var/www/html/site1
        <Directory /var/www/html/site1/>
                Options FollowSymLinks MultiViews
                AllowOverride all
                Order deny,allow
                Deny from all
                allow from 127.0.0.1
                allow from 10.22.22.0/24
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/site1_error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/site1_access.log combined
</VirtualHost>

#==== site2 WEBSITE ====

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName webtv

        DocumentRoot /var/www/html/site2
        <Directory /var/www/html/site2/>
                Options FollowSymLinks MultiViews
                AllowOverride all
                Order deny,allow
                Deny from all
                allow from 10.22.22.0/24
                allow from 127.0.0.1
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/site2_error.log
        LogLevel warn
        CustomLog ${APACHE_LOG_DIR}/site2_access.log combined

</VirtualHost>

```

* * *

edit your server hosts file so you can access any website you need from server,  
( if you host your custom files for blocking):

## **/etc/hosts**

```
127.0.0.1 localhost
127.0.1.1 ubuntu1
127.0.1.2 pihole
127.0.1.3 site1
127.0.1.4 site2

10.22.22.16 site1
10.22.22.16 site2
10.22.22.16 pihole
10.22.22.16 ubuntu1

```

* * *

**copy all web files for pihole ( move it from /var/www/html/ ) and also content from pihole in dns:**  
it will look like this:

```
/var/www/html/dns/admin/...
/var/www/html/dns/pihole/...
/var/www/html/dns/blockingpage.css
/var/www/html/dns/index.js
/var/www/html/dns/index.php
/var/www/html/site1/...
/var/www/html/site2/...

```

If I did not forgot something this is all you need to change to have pihole working in Apache, so now reload/restart apache.

---

_[View the full topic](https://discourse.pi-hole.net/t/migrating-pi-hole-from-lighttpd-to-apache/152)._
