How to Install SWAG on Clear Linux Latest

In this tutorial, we will show you how to install SWAG (Secure Web Application Gateway) on Clear Linux Latest. SWAG is a docker container that acts as a reverse proxy and provides SSL/TLS encryption to web applications.

Prerequisites

Before starting this tutorial, you need to have the following prerequisites:

Step 1: Clone the SWAG repository

First, we need to clone the SWAG repository from GitHub. Open the terminal and run the following command:

git clone https://github.com/linuxserver/docker-swag.git

This will clone the SWAG repository to the current directory.

Step 2: Configure the SWAG container

Next, we need to configure the SWAG container by editing the docker-compose.yml file. We can use any text editor to edit this file. For example, we can use nano as follows:

cd docker-swag
nano docker-compose.yml

In the docker-compose.yml file, we need to set the following environment variables:

Here is an example configuration for SWAG:

version: "3"
services:
  swag:
    image: ghcr.io/linuxserver/swag
    container_name: swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - URL=example.com #change this to your domain name or IP address
      - SUBDOMAINS=www,ftp #change this to your subdomains
      - VALIDATION=duckdns
      - DUCKDNSTOKEN=<your-duckdns-token>
      - EMAIL=<your-email-address>
    volumes:
      - /path/to/your/config:/config
    ports:
      - 443:443
      - 80:80
    restart: unless-stopped

In this example, we set the URL to example.com, the subdomains to www and ftp, and the email address to <your-email-address>. Make sure to replace these values with your own.

We also added the DUCKDNSTOKEN environment variable for DUCKDNS validation. You can use any other validation method such as HTTP or DNS. Check the official SWAG documentation for more information.

Finally, we mounted the configuration directory to /config path in the container. This is where the Let's Encrypt certificate and related files will be saved.

Save and close the docker-compose.yml file.

Step 3: Start the SWAG container

Now we are ready to start the SWAG container. To do this, open the terminal and run the following command:

docker-compose up -d

This will start the SWAG container in the background.

Step 4: Verify the SWAG container

We can verify that the SWAG container is running by checking its logs. Open the terminal and run the following command:

docker logs swag

This will show the log output of the SWAG container. If everything is fine, you should see something like:

Server ready
Listening on [::]:80...
Listening on [::]:443...

Step 5: Test the SWAG container

To test the SWAG container, open a web browser and navigate to your web application URL (e.g. https://example.com).

If everything is working fine, you should see your web application running with SSL/TLS encryption provided by SWAG.

Conclusion

In this tutorial, we showed you how to install SWAG on Clear Linux Latest. SWAG is a docker container that acts as a reverse proxy and provides SSL/TLS encryption to web applications. Now you can secure your web application using SWAG with ease.

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!