Overview
I recently launched an instance of AnonymousOverflow at ao.cleberg.net and wanted to write a brief post on how easy it is to install with Docker Compose and Nginx.
This guide uses Ubuntu server, Docker Compose, and Nginx as a reverse proxy.
Installation
Docker Compose
To install AnonymousOverflow, start by creating a directory for the application
and create its docker-compose.yml
file.
&&
Within this file, paste the following information. Be sure to change the
APP_URL
, JWT_SIGNING_SECRET
, and ports
to match your needs.
version: "3"
services:
anonymousoverflow:
container_name: "app"
image: "ghcr.io/httpjamesm/anonymousoverflow:release"
environment:
- APP_URL=https://ao.example.com
- JWT_SIGNING_SECRET=secret #pwgen 40 1
ports:
- "9380:8080"
restart: "always"
Save and exit the file when complete. You can now launch the container and access it via your local network.
Nginx Reverse Proxy
If you want to access this service outside the local network, I recommend using Nginx as a reverse proxy.
Let's start by creating a configuration file.
Within this file, paste the following content and repace ao.example.com
with
your URL. You may need to update the SSL certificate statements if your
certificates are in a different location.
server {
if ($host ~ ^[^.]+\.cleberg\.net$) {
301 ;
}
::]:80;
[80;
.example.com;
ao404;
}
server {
::]:443 ssl http2;
[443 ssl http2;
.example.com;
ao/var/log/nginx/ao.access.log;
/var/log/nginx/ao.error.log;
X-Content-Type-Options "nosniff";
X-XSS-Protection "1; mode=block";
X-Frame-Options "DENY";
-Transport-Security "max-age=63072000; includeSubDomains";
Strict-Policy "no-referrer";
Referrer
/etc/letsencrypt/live/example.com/fullchain.pem;
/etc/letsencrypt/live/example.com/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
/etc/letsencrypt/ssl-dhparams.pem;
location / {
$upstream_ao ;
$upstream_ao;
$host;
Host $http_upgrade;
Upgrade Connection upgrade;
-Encoding gzip;
AcceptX-Real-IP $remote_addr;
X-Forwarded-For $proxy_add_x_forwarded_for;
X-Forwarded-Proto $scheme;
X-Forwarded-Host $http_host;
X-Forwarded-Uri $request_uri;
X-Forwarded-Ssl on;
:// $scheme://;
http1.1;
"";
Connection $cookie_session;
$cookie_session;
64 256k;
}
}
Save and exit the file when complete. On Ubuntu, you will need to symlink the configuration file before it will be recognized by Nginx. Once complete, simply restart the web server.
The website will now be available publicly. Visit my instance for an example.