AdguardTeam / AdGuardHome

Network-wide ads & trackers blocking DNS server
https://adguard.com/adguard-home.html
GNU General Public License v3.0
25.46k stars 1.83k forks source link

Refresh the VPS Wiki page #4275

Open ainar-g opened 2 years ago

ainar-g commented 2 years ago

https://github.com/AdguardTeam/AdGuardHome/wiki/VPS

We should probably consolidate the Nginx / Caddy stuff in there. Also add the information about trusted_proxies and the related proxy stuff.

Some additional references to the information we probably want to have there:

baoang commented 2 years ago

That would be a small step in documentation, but a giant leap for AdGuardHome fanboys!

I'd recommend a reddit post, very detailed info and explanations, posted by me but answered by r/szhu25. I think the answers and the codes/configs can enlighten AGH starters.

What is the purpose of setting "/dns-query" block in Nginx's reverse proxy config?

And also a couple of other related posts at r/AdGuard board. Sadly, not the r/AdGuardHome board.

Actually, a detailed and substantialized instructions (my native language is not English, here I mean specific examples for starter's copy-and-paste to fit their requirements under various environment, as NextCloud documentations for admin deployment) posted here in Wiki will reduce the burden of developers, and developers can focus on the bugs and codes writing, making issues column back to where it is. Looks discussion column a bit abandoned. There are some posts/issues that contain not very correct, or at least not generally correct examples/solutions. I personally referenced this post/issues, but was distracted until I went to reddit and got a warmhearted answer from r/szhu25, and I knew where I have been going wrong: most part due to my lack of understanding of nginx's reverse concept.

ppfeufer commented 2 years ago

Not everyone is using Nginx, some lines about Apache would also be very nice :-)

ainar-g commented 2 years ago

@ppfeufer, if you have any links or example configs, we'll try to add them as well.

ppfeufer commented 2 years ago

Just my own so far, which probably doesn't cover everything that's possible

HTTP (/etc/apache2/sites-available/adguard.conf):

<VirtualHost *:80>
    ServerName adguard.url

    <Location "/">
        ProxyPass "http://192.168.178.200:8100/"
        ProxyPassReverse "http://192.168.178.200:8100/"
    </Location>

    # SSL Redirect
    RewriteEngine on
    RewriteCond %{SERVER_NAME} =adguard.url
    RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>

HTTPS (/etc/apache2/sites-available/adguard-le-ssl.conf):

<IfModule mod_ssl.c>
    <VirtualHost *:443>
        ServerName adguard.url

        <Location "/">
            ProxyPass "http://192.168.178.200:8100/"
            ProxyPassReverse "http://192.168.178.200:8100/"
        </Location>

        SSLCertificateFile /etc/letsencrypt/live/adguard.url/fullchain.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/adguard.url/privkey.pem
        Include /etc/letsencrypt/options-ssl-apache.conf
    </VirtualHost>
</IfModule>

Obviously, replace adguard.url with the actual URL ...

Both need to be linked into /etc/apache2/sites-enabled/ in order to be found by the Apache webserver. SSL setup is optional but recommended.

As said, these are just the basics to get the web interface working. All the other fun stuff like /dns-query and so on, I haven't found anything yet so far, and was kinda hoping for it to be honest :-)

The following Apache modules need to be active: