diff --git a/conf/nginx.conf b/conf/nginx.conf index 03bc88a..af1bcbd 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,14 +1,87 @@ +# snikket-web-proxy/nginx/snikket-common.template location / { - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; + try_files $uri /static/$uri @portal; +} - client_max_body_size 1M; # default is 1M +location /admin_api { + try_files none @prosody; +} - proxy_connect_timeout 10m; - proxy_send_timeout 10m; - proxy_read_timeout 10m; - send_timeout 10m; +location /invites_api { + try_files none @prosody; +} - proxy_pass http://127.0.0.1:__PORT__; -} \ No newline at end of file +location /invites_bootstrap { + try_files none @prosody; +} + +location /share { + alias /usr/share/javascript; +} + +location /upload { + client_max_body_size 104857616; # 100MB + 16 bytes (see Prosody config) + proxy_request_buffering off; + proxy_http_version 1.1; + try_files none @prosody; +} + +location /http-bind { + try_files none @prosodyws; +} + +location /xmpp-websocket { + try_files none @prosodyws; +} + +location = /.well-known/host-meta { + try_files none @prosody; +} + +location = /.well-known/host-meta.json { + try_files none @prosody; +} + +location @portal { + proxy_pass http://localhost:__PORT__; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; +} + +location @prosody { + proxy_pass http://localhost:__PORT_HTTP__; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; +} + +location @prosodyws { + proxy_pass http://localhost:__PORT_HTTP__; + proxy_http_version 1.1; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + + proxy_read_timeout 900s; +} + +location /_health/portal { + proxy_pass http://localhost:__PORT__/_health; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; +} + +location /_health/xmpp { + proxy_pass http://localhost:__PORT_HTTP__/host_status_check; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; +} + +error_page 502 /_errors/502.html; +error_page 503 /_errors/503.html; +error_page 504 /_errors/504.html; \ No newline at end of file diff --git a/conf/nginx.groups.conf b/conf/nginx.groups.conf index f0fc921..bfe04f7 100644 --- a/conf/nginx.groups.conf +++ b/conf/nginx.groups.conf @@ -1,14 +1,5 @@ -location / { # TODO - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; +root /var/www/snikket/snikket_web; - client_max_body_size 1M; # default is 1M - - proxy_connect_timeout 10m; - proxy_send_timeout 10m; - proxy_read_timeout 10m; - send_timeout 10m; - - proxy_pass http://127.0.0.1:__PORT__; +location / { + return 301 https://__DOMAIN__/; } \ No newline at end of file diff --git a/conf/nginx.share.conf b/conf/nginx.share.conf index f0fc921..f1b2616 100644 --- a/conf/nginx.share.conf +++ b/conf/nginx.share.conf @@ -1,14 +1,15 @@ -location / { # TODO - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; +root /var/www/snikket/snikket_web; - client_max_body_size 1M; # default is 1M +location / { + return 301 https://__DOMAIN__/; +} - proxy_connect_timeout 10m; - proxy_send_timeout 10m; - proxy_read_timeout 10m; - send_timeout 10m; - - proxy_pass http://127.0.0.1:__PORT__; +location /upload/ { + client_max_body_size 104857616; # 100MB + 16 bytes (see Prosody config) + proxy_request_buffering off; + proxy_http_version 1.1; + proxy_pass http://localhost:__PORT__; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto https; } \ No newline at end of file diff --git a/scripts/install b/scripts/install index 5ab0f70..4405101 100755 --- a/scripts/install +++ b/scripts/install @@ -112,8 +112,10 @@ pushd "$install_dir/snikket_web" python -m venv .venv cp -r "$portaldir"/usr/lib/python3/dist-packages/* .venv/lib/python*/site-packages/ cp -r "$portaldir"/usr/local/lib/python3.11/dist-packages/* .venv/lib/python*/site-packages/ + .venv/bin/pip3 install --force babel # TODO: This is not ideal popd +# TODO: Install the create-invite script (with env setting) #================================================= # CLEAN TEMPORARY FILES #=================================================