[SWAG] Nginx error since the last few updates

Since the last few days i am geeting an error in my swag container, saying the following:

nginx: [emerg] "stream" directive is not allowed here in /etc/nginx/conf.d/stream.conf:3

After deleting the stream.conf file from inside the container (e.g. not the user config files) the container works until the next update that breaks it again.

This is the content of the file:

# /etc/nginx/conf.d/stream.conf

stream {
        # Specifies the main log format.
        log_format main '$remote_addr [$time_local] '
                        '$protocol $status $bytes_sent $bytes_received '
                        '$session_time "$upstream_addr" '
                        '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';

        access_log /var/log/nginx/stream.log main;

        # Includes servers configs.
        include stream.d/*.conf;
}

Now i find it unlikely that the whole swag container would be broken for everybody and not fixed over the course of 2-3 days, so i think this is somehow related to my setup. Basically i use swag to pull letsencrypt certificated and act as a reverse proxy for the apps on my network.

Any help is appreciated.

1 Like

Does not appear to be unique to your setup, at least not unless we both have identical setups somehow.
I can confirm I just updated my docker compose stack with a fresh pull this morning and my working SWAG broke.
I am getting the same error as you are in the logs inside the SWAG container in /var/log/nginx/error.log I have line after line like this
[emerg] 605#605: “stream” directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
[emerg] 610#610: “stream” directive is not allowed here in /etc/nginx/conf.d/stream.conf:3
[emerg] 615#615: “stream” directive is not allowed here in /etc/nginx/conf.d/stream.conf:3

After rm /etc/nginx/conf.d/stream.conf I can once again access heimdall and my other proxied services.

3 Likes

so it seems its a bug in the container itself. i have googled for the error but did not find any results, so i assumed only specific setups are affected.

Hi, after the latest update of SWAG on UNRAID I have exactly the same issue “stream” directive is not allowed here in /etc/nginx/conf.d/stream.conf:3

Interessting is, that Inside the container I dont have “stream.conf”. Also in user config no such “stream.conf” file… Before update everything was working without any issues…

Any help appreciated.

Edit: Solved - You have to update the nginx.conf and ssl.conf according to new sample files provided! Everything is working now.

7 Likes

Damn, thanks so much! Everything is working again for me now :slight_smile:

Thanks for the answer, but my config is very different from the sample. Any tips on what really needs to be updated?

EDIT: Renamed the stream.conf inside the docker image and server is working again. Is the stream.conf file needed or is my config messed up?

Had this issue also. Renamed the stream.conf file and rebooted the container and all is back normal for me. Will this occur every time swag updates? Can you elaborate for a newb " You have to update the nginx.conf and ssl.conf according to new sample files provided !" what exactly this process is?

If you look at the nginx.conf and ssl.conf files compared to the *.sample versions, you’ll see that the samples were updated in 2022. I’m assuming the old versions of these files are no longer compatible with the configuration, hence why the container isn’t running.

As I hadn’t made any customizations to either of these files in my install, I simply renamed up the old versions to *.bak, then copied the *.sample files and removed the .sample from the end. Once I rebooted the container, everything looks to be working correctly!

Hope this helps!

2 Likes

Thanks for this explanation!

As a note to all of you, this solution with instructions, is in your container logs. How to get your container logs are referenced in the readme of every LSIO container. For the stream issue, it’s just nginx.conf that needs to be updated (due to an upstream alpine change), but you should check container logs anyway to ensure your configs are up to date.

Make sure you COMPARE old to new if you made any changes to the configs. User customization is why we don’t simply update the configs as this would cause users to lose data.

1 Like