[GH-ISSUE #18] Sorry about noob question :) #17

Closed
opened 2026-02-26 05:33:02 +03:00 by kerem · 4 comments
Owner

Originally created by @zaywalker on GitHub (Sep 18, 2018).
Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/18

hello again!
It's hard to figure the custom configuration without knowledge about linux and nginx. T_T
I've attached some server successfully like home assistant with custom confuguration, but now I'm hit the wall to handle web terminal called "butterfly".
currently, it's fine to run with redirection host and i'm now trying to do with reverse proxy.
the instruction is
https://github.com/paradoxxxzero/butterfly/wiki/Butterfly-with-nginx-reverse-proxy-and-https

server {
    listen       80;
    listen       443 ssl;

    listen       [::]:80;
    listen       [::]:443 ssl;

    server_name  example.com;
    ssl_certificate certs/example.com.chained.crt;
    ssl_certificate_key certs/example.com.key;

    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers         HIGH:!aNULL:!MD5;

    charset utf-8;

    access_log  /var/log/nginx/$host.access.log;

    client_max_body_size 20M;

    root   /var/www/;
    index  index.html index.htm;

    if ($ssl_protocol = "") {
        return 301 https://$http_host$request_uri;
    }

    location / {
        try_files $uri $uri/ =404;
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    location /butterfly {
        auth_basic "Authentication required";
        auth_basic_user_file /etc/nginx/.htpasswd;

        rewrite ^/butterfly/?(.*) /$1 break;
        proxy_pass http://127.0.0.1:57575;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header Origin "$scheme://$host";

        proxy_connect_timeout 7d;                                                                                                              
        proxy_send_timeout 7d;                                                                                                                 
        proxy_read_timeout 7d;

        sub_filter_once off;

        sub_filter_types text/css text/xml application/javascript;
        sub_filter /style.css '/butterfly/style.css';
        sub_filter /static '/butterfly/static';
        sub_filter /ws '/butterfly/ws';
        sub_filter /themes '/butterfly/themes';
        sub_filter location.pathname '"/"';
    }

    rewrite ^/theme/?(.*)/butterfly/?(.*) /butterfly/theme/$1/$2 permanent;
}

this instruction is for cname? domain like aaa.bbb.ccc/butterfly

but i'm trying to make subdomain butterfly.bbb.ccc

when I try to do location / , proxy status turns offline...

any help will be great for me!

thanks advance!

Originally created by @zaywalker on GitHub (Sep 18, 2018). Original GitHub issue: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/18 hello again! It's hard to figure the custom configuration without knowledge about linux and nginx. T_T I've attached some server successfully like home assistant with custom confuguration, but now I'm hit the wall to handle web terminal called "butterfly". currently, it's fine to run with redirection host and i'm now trying to do with reverse proxy. the instruction is https://github.com/paradoxxxzero/butterfly/wiki/Butterfly-with-nginx-reverse-proxy-and-https ``` server { listen 80; listen 443 ssl; listen [::]:80; listen [::]:443 ssl; server_name example.com; ssl_certificate certs/example.com.chained.crt; ssl_certificate_key certs/example.com.key; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers HIGH:!aNULL:!MD5; charset utf-8; access_log /var/log/nginx/$host.access.log; client_max_body_size 20M; root /var/www/; index index.html index.htm; if ($ssl_protocol = "") { return 301 https://$http_host$request_uri; } location / { try_files $uri $uri/ =404; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } location /butterfly { auth_basic "Authentication required"; auth_basic_user_file /etc/nginx/.htpasswd; rewrite ^/butterfly/?(.*) /$1 break; proxy_pass http://127.0.0.1:57575; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_set_header Host $host; proxy_set_header Origin "$scheme://$host"; proxy_connect_timeout 7d; proxy_send_timeout 7d; proxy_read_timeout 7d; sub_filter_once off; sub_filter_types text/css text/xml application/javascript; sub_filter /style.css '/butterfly/style.css'; sub_filter /static '/butterfly/static'; sub_filter /ws '/butterfly/ws'; sub_filter /themes '/butterfly/themes'; sub_filter location.pathname '"/"'; } rewrite ^/theme/?(.*)/butterfly/?(.*) /butterfly/theme/$1/$2 permanent; } ``` this instruction is for cname? domain like aaa.bbb.ccc/butterfly but i'm trying to make subdomain butterfly.bbb.ccc when I try to do location / , proxy status turns offline... any help will be great for me! thanks advance!
kerem closed this issue 2026-02-26 05:33:02 +03:00
Author
Owner

@jc21 commented on GitHub (Sep 18, 2018):

Wow that's a lot of unnecessary crap they want you to do.

You should only need this location block, without all the ssl, redirections and basic authentication that the NPM will already handle. Even then, the only reason you need this is because of the websocket upgrade that is mixed in with all of it.

location ~ .*/ws.* {
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_http_version 1.1;
    proxy_pass http://$server:$port;
    proxy_connect_timeout 7d;
    proxy_send_timeout 7d;
    proxy_read_timeout 7d;
}

Give that a go. I'm not prepared to install butterfly to test it out though :)

<!-- gh-comment-id:422349113 --> @jc21 commented on GitHub (Sep 18, 2018): Wow that's a lot of unnecessary crap they want you to do. You should only need this location block, without all the ssl, redirections and basic authentication that the NPM will already handle. Even then, the only reason you need this is because of the websocket upgrade that is mixed in with all of it. ``` location ~ .*/ws.* { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; proxy_pass http://$server:$port; proxy_connect_timeout 7d; proxy_send_timeout 7d; proxy_read_timeout 7d; } ``` Give that a go. I'm not prepared to install butterfly to test it out though :)
Author
Owner

@zaywalker commented on GitHub (Sep 18, 2018):

@jc21 Super thanks for the reply! I've tried the location block, unfortunatly, I got black screen like before. Even restart NPM docker.
But, I've learn some clue about
~ .*/ws.*
I'll try do this another way!
Thanks eyery time!

<!-- gh-comment-id:422402049 --> @zaywalker commented on GitHub (Sep 18, 2018): @jc21 Super thanks for the reply! I've tried the location block, unfortunatly, I got black screen like before. Even restart NPM docker. But, I've learn some clue about `~ .*/ws.*` I'll try do this another way! Thanks eyery time!
Author
Owner

@jc21 commented on GitHub (Oct 1, 2018):

For future reference, I added another setting for Proxy Hosts in version 2.0.3 you can use for any hosts that need websocket upgrades. Just turn on "Allow Websocket HTTP Upgrades" and hopefully everything works without the need for advanced config.

<!-- gh-comment-id:426085696 --> @jc21 commented on GitHub (Oct 1, 2018): For future reference, I added another setting for Proxy Hosts in version 2.0.3 you can use for any hosts that need websocket upgrades. Just turn on "Allow Websocket HTTP Upgrades" and hopefully everything works without the need for advanced config.
Author
Owner

@zaywalker commented on GitHub (Oct 2, 2018):

working great!!! thanks!

<!-- gh-comment-id:426187492 --> @zaywalker commented on GitHub (Oct 2, 2018): working great!!! thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nginx-proxy-manager-NginxProxyManager#17
No description provided.