How to Install SWAG (Secure Web Application Gateway) on NixOS Latest

Introduction

SWAG (Secure Web Application Gateway) is a Docker-based reverse proxy and one of the easiest and simplest ways to access your web applications securely. In this tutorial, we will be installing SWAG on NixOS latest.

Prerequisites

Before proceeding with this tutorial, you need to have the following prerequisites installed on your system:

Installation

The following steps will help you to install SWAG on NixOS latest:

  1. Open your NixOS terminal.
  2. Clone the SWAG GitHub repository using the following command:
git clone https://github.com/linuxserver/docker-swag
  1. Once you have cloned the repository, navigate to the cloned directory:
cd docker-swag
  1. Copy the .env.sample file to .env:
cp .env.sample .env
  1. Open the .env file in your favorite text editor and configure the following settings:
# Domain name for your SWAG server
DOMAIN=yourdomain.com

# Email address to register SSL certificate request 
EMAIL=youremail@gmail.com

# Enable Let's Encrypt SSL verification
STAGING=false

# Path to your SWAG data folder
DATA_DIR=/path/to/swag/data

# Path to your Nginx configuration folder
NGINX_DIR=/path/to/swag/nginx/

# Path to your Nginx.conf file
NGINX_CONF=/path/to/swag/nginx/nginx.conf

# Path to your Apache SSL configuration 
APACHE_SSL_DIR=/path/to/swag/apache/

# Path to your Caddyfile
CADDYFILE=/path/to/swag/caddy/Caddyfile

# Path to your PHP configuration file
PHP_INI=/path/to/swag/php/php.ini

# Path to your HTTP/HTTPS certification folder
CERT_DIR=/path/to/swag/certs/
  1. Create a new Docker network using the following command:
docker network create swag
  1. Run the SWAG Docker container using the following command:
docker-compose up -d
  1. Verify that the SWAG container is running by executing the following command:
docker ps

You should see the SWAG container listed in the output.

Congratulations! You have successfully installed SWAG on NixOS latest.

Conclusion

In this tutorial, we have shown you how to install SWAG (Secure Web Application Gateway) on NixOS latest. SWAG is a simple and efficient way to access your web applications securely. With SWAG, you can enjoy a secure and reliable web experience, with the confidence that your data is protected.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!