AdGuard Home is a powerful self-hosted network-wide ad blocker and tracker blocker. It works as a DNS server to filter unwanted content at the DNS level, giving you full control over your browsing experience. By hosting AdGuard Home yourself, you can enhance privacy, reduce dependency on third-party services, and customize it to meet your needs. In this guide, we'll cover installation, configuration, logging, backups, updates, and leveraging AdGuard Home's unique features.
Installing AdGuard Home
π¦ Docker/Docker Compose Setup
Using Docker is one of the most efficient ways to deploy AdGuard Home. Here's how to set it up with Docker Compose:
- Create a
docker-compose.yml
file tailored to AdGuard Home:
version: "3.8"
services:
adguardhome:
image: adguard/adguardhome:latest
container_name: adguardhome
restart: unless-stopped
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp"
- "443:443/tcp"
- "3000:3000/tcp"
volumes:
- ./adguard/work:/opt/adguardhome/work
- ./adguard/conf:/opt/adguardhome/conf
environment:
- TZ=UTC
- Bring up the container using Docker Compose:
docker-compose up -d
This will set up AdGuard Home to persist configurations and logs in the ./adguard
directory.
π Manual Installation
For those deploying directly on a Linux server, follow these steps:
- Download the latest version of AdGuard Home:
curl -sSL https://static.adguard.com/adguardhome/release/AdGuardHome_linux_amd64.tar.gz -o AdGuardHome.tar.gz
- Extract the downloaded file:
tar -xvf AdGuardHome.tar.gz
cd AdGuardHome
- Run the installation script:
sudo ./AdGuardHome -s install
This will install and automatically start AdGuard Home as a system service.
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
To route traffic to AdGuard Home, configure Nginx to act as a reverse proxy:
- Create a new Nginx server block configuration file (e.g.,
/etc/nginx/sites-available/adguard
):
server {
listen 80;
server_name adguard.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
- Enable the site and reload Nginx:
sudo ln -s /etc/nginx/sites-available/adguard /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
π SSL/TLS Setup
Secure AdGuard Home with a Let's Encrypt SSL certificate:
- Install Certbot:
sudo apt install certbot python3-certbot-nginx
- Obtain and configure the certificate:
sudo certbot --nginx -d adguard.example.com
- Automate SSL certificate renewal:
sudo systemctl enable certbot.timer
Logging and Debugging AdGuard Home
ποΈ Enabling Debug Logs
To enable debug logging in AdGuard Home, edit the AdGuardHome.yaml
configuration file:
log_level: debug
Restart the service to apply changes:
sudo systemctl restart AdGuardHome
π Viewing Logs
For Docker users:
docker logs -f adguardhome
For manual installations, logs are stored in the work
directory:
tail -f /opt/AdGuardHome/work/logs.txt
π οΈ Troubleshooting Common Issues
- Check system-level logs for DNS or binding errors:
sudo journalctl -u AdGuardHome
- Verify if other applications are using conflicting ports with:
sudo netstat -tulnp
Backup and Restore
ποΈ File-Based Backups
Back up the configuration and work directories:
sudo tar -czvf adguard-backup-$(date +%F).tar.gz /opt/AdGuardHome/conf /opt/AdGuardHome/work
π Automated Backup Scripts
Create a cron job to back up AdGuard Home daily:
crontab -e
Add the following line to schedule backups at 2 AM daily:
0 2 * * * tar -czvf /var/backups/adguard-backup-$(date +\%F).tar.gz /opt/AdGuardHome/conf /opt/AdGuardHome/work
Updating and Upgrading AdGuard Home
β¬οΈ Updating Docker Images
To update AdGuard Home when using Docker:
docker-compose pull
docker-compose up -d
π οΈ Manual Updates
For manual installations, download the latest version and overwrite the existing files:
curl -sSL https://static.adguard.com/adguardhome/release/AdGuardHome_linux_amd64.tar.gz -o AdGuardHome.tar.gz
tar -xvf AdGuardHome.tar.gz
sudo ./AdGuardHome -s install
Leveraging AdGuard Homeβs Unique Features
π§ Enabling APIs
AdGuard Home provides an API for advanced integrations. Enable it in AdGuardHome.yaml
:
api:
enabled: true
bind_addr: 0.0.0.0:3000
Restart the service:
sudo systemctl restart AdGuardHome
Test the API with a simple curl
request:
curl -X GET "http://127.0.0.1:3000/control/status"
AdGuard Home empowers you to take control of your networkβs privacy and performance. With this guide, you now have the tools to deploy, configure, and manage it effectively. Start leveraging its powerful features and enjoy an ad-free, secure browsing experience!