From 1b4ef93c61af4f48902e8f0e3cef4e5cd5743b97 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Tue, 3 Nov 2020 17:15:14 +0100 Subject: [PATCH] fix --- conf/nginx.conf | 51 +++++++++++++++++++++++++++++++++----------- conf/systemd.service | 2 +- scripts/install | 2 +- 3 files changed, 40 insertions(+), 15 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index f864b30..f28b23c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,19 +4,44 @@ location ^~ / { rewrite ^ https://$server_name$request_uri? permanent; } - proxy_pass http://127.0.0.1:__PORT__/; - proxy_redirect off; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Host $server_name; + location __PATH__/ { + proxy_pass http://127.0.0.1:8000; + # auth_basic "Viewer Only"; + # auth_basic_user_file .htpasswd; + } - proxy_http_version 1.1; - proxy_set_header Connection "upgrade"; - proxy_set_header Upgrade $http_upgrade; + location ~ __PATH__/\. { + deny all; + } + + location ~ __PATH__/edit$ { + proxy_pass http://127.0.0.1:8000; + auth_basic "Editor Only"; + auth_basic_user_file .htpasswd; + } + + # Example for mounting under /ethercalc + location __PATH__ { + return 301 $scheme://$server_name$request_uri/; + } + location __PATH__/ { + proxy_pass http://127.0.0.1:8000; + rewrite /ethercalc(/.*) $1 break; + } + location __PATH__/socket.io { + proxy_pass http://127.0.0.1:8000; + rewrite /ethercalc(/.*) $1 break; + # WebSocket support + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + } + + ### Uncomment this if running with --basepath /path/prefix + location __PATH__/zappa/socket/__local/ { + rewrite (.*) /path/prefix$1; + } + } - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; - more_clear_input_headers 'Accept-Encoding'; } \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index 3d549ef..0c7aacd 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,7 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment="PATH=__ENV_PATH__" Environment="NODE_ENV=production" -ExecStart=__FINALPATH__/bin/ethercalc --port __PORT__ --expire __EXPIRE__ +ExecStart=__FINALPATH__/bin/ethercalc --host 127.0.0.1 --port __PORT__ --expire __EXPIRE__ --polling --basepath /path/prefix RuntimeMaxSec=86400 Restart=always diff --git a/scripts/install b/scripts/install index 16f9650..0d72a90 100644 --- a/scripts/install +++ b/scripts/install @@ -102,7 +102,7 @@ ynh_script_progression --message="Building EtherCalc... (this will take some tim pushd "$final_path" || ynh_die ynh_use_nodejs - ynh_exec_warn_less npm install -g ethercalc + ynh_exec_warn_less npm install #-g ethercalc popd || ynh_die #=================================================