Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

using nginx #241

Closed
SimplySeth opened this issue Feb 27, 2018 · 2 comments
Closed

using nginx #241

SimplySeth opened this issue Feb 27, 2018 · 2 comments

Comments

@SimplySeth
Copy link

is there a specific flag I'm supposed to use to get it working with nginx ?

I'm trying to setup a container with alertmanager and unsee
when I hit /unsee or /unsee I get a 404

I run unsee with the following ...

/usr/bin/unsee --listen.port 9095 --alertmanager.uri http://127.0.0.1:9094 --listen.prefix /unsee

This is my nginx file ...

server {
    listen 9093;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:9094;
        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

server {
    listen 9093;

    location /unsee {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:9095;
        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}
@prymitive
Copy link
Contributor

prymitive commented Feb 28, 2018

I'm no nginx expert but don't you need location ^~ /unsee to pass all requests with the /unsee prefix to unsee, not only "/unsee"?

@SimplySeth
Copy link
Author

Got it !

This is the command to run in the container:

/usr/bin/alertmanager --config.file=/etc/alertmanager/alertmanager.yml --storage.path=/var/lib/alertmanager --web.listen-address=":9094"

/usr/bin/unsee --listen.prefix /unsee --alertmanager.uri http://127.0.0.1:9094

I'm also running cloudcommander for editing and uploading files:

/usr/bin/cloudcmd --prefix /edit --no-console --no-terminal --no-online --no-config-dialog --no-contact

this is what the nginx file should be ...

server {
    listen 9093;
    listen [::]:9093;
    server_name _;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:9094;
        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    location /edit/ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:8000;
        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
    location /unsee/ {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Host $http_host;
        proxy_set_header X-NginX-Proxy true;

        proxy_pass http://127.0.0.1:8080;
        proxy_redirect off;

        # Socket.IO Support
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }
}

Hope this can be of help to someone ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants