I'm a big proponent of having offline copies of content. Especially when I'm on travel and don't have easy Internet access. Using the built in hugo webserver and a reverse proxy, I will show how we can host a local mirror of a Hugo site.
## Systemd Service
To begin with, let's create a systemd service that will start up the Hugo webserver automatically. To demonstrate this, I will show a mirror of my website.
Replace `httpd` with whatever reverse proxy service this depends on. For every site you mirror, you need to make sure that the port (specified by `-p`) is different.
Now let's start and enable the service.
```bash
sudo systemctl start brandonrozek
sudo systemctl enable brandonrozek
```
## Nginx Config
If you are using Nginx as your reverse proxy, we will need to create a config at `/etc/nginx/sites-available/brandonrozek.conf`.
```nginx
server {
location /brandonrozek {
proxy_pass http://localhost:22160;
proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $host;
}
}
```
Then to enable it.
```bash
sudo ln -s \
/etc/nginx/sites-available/brandonrozek.conf \
/etc/nginx/sites-enabled/
sudo systemctl restart httpd
```
## Apache HTTPD Config
If you are using apache as your reverse proxy, create a config at `/etc/httpd/conf.d/brandonrozek.conf`