ex0nuss / Remote-Wake-Sleep-On-LAN-Docker

A docker image of sciguy14/Remote-Wake-Sleep-On-LAN-Server
GNU General Public License v3.0
34 stars 16 forks source link

Using with SWAG #2

Closed johnvick closed 2 years ago

johnvick commented 2 years ago

Thanks for this program I have been using for a while with Apache2. I am in the process of setting up a new Ubuntu server and would like to run the program with SWAG but I can't get a working nginx reverse proxy config. Any help appreciated.

ex0nuss commented 2 years ago

Hi, unfortunately I didn't get an mail from GitHub regarding your issue.

SWAG is great, I am also using it with Remote-Wake-Sleep-On-LAN-Docker.

  1. It's important the you have set network_mode: host in your docker-compose file. Otherwise the container can't send WOL magic packages. Just specify the port with the env-var (e.g. APACHE2_PORT=8080)
  2. In your swag you can do an normal config. --> Take a look at server_name, $upstream_app, $upstream_port

This is my one:

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name <WOL.SUB.DOMAIN>;

    include /config/nginx/ssl.conf;
    include /config/nginx/common.conf;
    include /config/nginx/geoip2-server.conf;

    client_max_body_size 0;

    # enable for ldap auth, fill in ldap details in ldap.conf
    #include /config/nginx/ldap.conf;

    # enable for Authelia
    #include /config/nginx/authelia-server.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable the next two lines for ldap auth
        #auth_request /auth;
        #error_page 401 =200 /ldaplogin;

        # enable for Authelia
        #include /config/nginx/authelia-location.conf;

        include /config/nginx/proxy.conf;
        resolver 127.0.0.11 valid=30s;
        set $upstream_app <IP_OF_YOUR_SERVER_RUNNING_THE_WOL-CONTAINER>;
        set $upstream_port <PORT_YOU_SPECIFIED_WITH__APACHE2_PORT>;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }

}
johnvick commented 2 years ago

Thanks, I got it working with help from one of the forums. Very useful utility.