aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2025-04-19 10:13:30 -0400
committerXe Iaso <me@xeiaso.net>2025-04-19 10:15:05 -0400
commita3dc8c4ed7918df92cc04ce7f9cb5e09ef4256cb (patch)
treeaa10ee40dd6008e40e48f0bcbbed5231ecab2ca8 /docs
parenta40c5e99fc182b6f2fbff5c3f94d9f46c1abce45 (diff)
downloadanubis-a3dc8c4ed7918df92cc04ce7f9cb5e09ef4256cb.tar.xz
anubis-a3dc8c4ed7918df92cc04ce7f9cb5e09ef4256cb.zip
docs/admin/installation: Apache documentation
Closes #277 This adds step by step documentation for setting up Anubis in Apache.
Diffstat (limited to 'docs')
-rw-r--r--docs/docs/CHANGELOG.md1
-rw-r--r--docs/docs/admin/installation.mdx126
2 files changed, 127 insertions, 0 deletions
diff --git a/docs/docs/CHANGELOG.md b/docs/docs/CHANGELOG.md
index 94cf468..f2ff353 100644
--- a/docs/docs/CHANGELOG.md
+++ b/docs/docs/CHANGELOG.md
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added FreeBSD rc.d script so can be run as a FreeBSD daemon.
- Allow requests from the Internet Archive
- Added example nginx configuration to documentation
+- Added example Apache configuration to the documentation [#277](https://github.com/TecharoHQ/anubis/issues/277)
## v1.16.0
diff --git a/docs/docs/admin/installation.mdx b/docs/docs/admin/installation.mdx
index 8a608b9..f558892 100644
--- a/docs/docs/admin/installation.mdx
+++ b/docs/docs/admin/installation.mdx
@@ -4,6 +4,9 @@ title: Setting up Anubis
import RandomKey from "@site/src/components/RandomKey";
+import Tabs from "@theme/Tabs";
+import TabItem from "@theme/TabItem";
+
Anubis is meant to sit between your reverse proxy (such as Nginx or Caddy) and your target service. One instance of Anubis must be used per service you are protecting.
<center>
@@ -76,6 +79,127 @@ Alternatively here is a key generated by your browser:
<RandomKey />
+## Apache
+
+Anubis is intended to be a filter proxy. The way to integrate this with nginx is to break your configuration up into two parts: TLS termination and then HTTP routing. Consider this diagram:
+
+```mermaid
+flowchart LR
+ T(User Traffic)
+ subgraph Apache 2
+ TCP(TCP 80/443)
+ US(TCP 3001)
+ end
+
+ An(Anubis)
+ B(Backend)
+
+ T --> |TLS termination| TCP
+ TCP --> |Traffic filtering| An
+ An --> |Happy traffic| US
+ US --> |whatever you're doing| B
+```
+
+Effectively you have one trip through Apache to do TLS termination, a detour through Anubis for traffic scrubbing, and then going to the backend directly. This final socket is what will do HTTP routing.
+
+:::note
+
+These examples assume that you are using a setup where your nginx configuration is made up of a bunch of files in `/etc/httpd/conf.d/*.conf`. This is not true for all deployments of Apache. If you are not in such an environment, append these snippets to your `/etc/httpd/conf/httpd.conf` file.
+
+:::
+
+Install the following dependencies:
+
+<Tabs>
+ <TabItem value="rpm" label="Red Hat / RPM" default>
+
+```text
+dnf -y install mod_proxy_html
+```
+
+ </TabItem>
+ <TabItem value="deb" label="Debian / Ubuntu / apt">
+
+```text
+apt-get install -y libapache2-mod-proxy-html libxml2-dev
+```
+
+ </TabItem>
+</Tabs>
+
+Assuming you are protecting `anubistest.techaro.lol`, you need the following server configuration blocks:
+
+1. A block on port 80 that forwards HTTP to HTTPS
+2. A block on port 443 that terminates TLS and forwards to Anubis
+3. A block on port 3001 that actually serves your websites
+
+```text
+# Plain HTTP redirect to HTTPS
+<VirtualHost *:80>
+ ServerAdmin your@email.here
+ ServerName anubistest.techaro.lol
+ DocumentRoot /var/www/anubistest.techaro.lol
+ ErrorLog /var/log/httpd/anubistest.techaro.lol_error.log
+ CustomLog /var/log/httpd/anubistest.techaro.lol_access.log combined
+ RewriteEngine on
+ RewriteCond %{SERVER_NAME} =anubistest.techaro.lol
+ RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
+</VirtualHost>
+
+# HTTPS listener that forwards to Anubis
+<VirtualHost *:443>
+ ServerAdmin your@email.here
+ ServerName anubistest.techaro.lol
+ DocumentRoot /var/www/anubistest.techaro.lol
+ ErrorLog /var/log/httpd/anubistest.techaro.lol_error.log
+ CustomLog /var/log/httpd/anubistest.techaro.lol_access.log combined
+
+ SSLCertificateFile /etc/letsencrypt/live/anubistest.techaro.lol/fullchain.pem
+ SSLCertificateKeyFile /etc/letsencrypt/live/anubistest.techaro.lol/privkey.pem
+ Include /etc/letsencrypt/options-ssl-apache.conf
+
+ # These headers need to be set or else Anubis will
+ # throw an "admin misconfiguration" error.
+ RequestHeader set "X-Real-Ip" expr=%{REMOTE_ADDR}
+ RequestHeader set X-Forwarded-Proto "https"
+
+ ProxyPreserveHost On
+
+ ProxyRequests Off
+ ProxyVia Off
+
+ # Replace 9000 with the port Anubis listens on
+ ProxyPass / http://[::1]:9000/
+ ProxyPassReverse / http://[::1]:9000/
+</VirtualHost>
+</IfModule>
+
+# Actual website config
+<VirtualHost *:3001>
+ ServerAdmin your@email.here
+ ServerName anubistest.techaro.lol
+ DocumentRoot /var/www/anubistest.techaro.lol
+ ErrorLog /var/log/httpd/anubistest.techaro.lol_error.log
+ CustomLog /var/log/httpd/anubistest.techaro.lol_access.log combined
+</VirtualHost>
+```
+
+Make sure to add a separate configuration file for the listener on port 3001:
+
+```text
+# /etc/httpd/conf.d/listener-3001.conf
+
+Listen 3001
+```
+
+This can be repeated for multiple sites. Anubis does not care about the HTTP `Host` header and will happily cope with multiple websites via the same instance.
+
+Then reload your Apache config and load your website. You should see Anubis protecting your apps!
+
+```text
+sudo systemctl reload httpd.service
+```
+
## Docker compose
Add Anubis to your compose file pointed at your service:
@@ -342,6 +466,8 @@ upstream anubis {
}
```
+This can be repeated for multiple sites. Anubis does not care about the HTTP `Host` header and will happily cope with multiple websites via the same instance.
+
Then reload your nginx config and load your website. You should see Anubis protecting your apps!
```text