From 5ebca792a76ca849c01076f865484b1ec88c2dca Mon Sep 17 00:00:00 2001 From: oufmilo <44617467+oufmilo@users.noreply.github.com> Date: Thu, 22 Dec 2022 21:19:21 +0100 Subject: [PATCH] Update nginx.conf --- conf/nginx.conf | 74 ++++++++++++------------------------------------- 1 file changed, 17 insertions(+), 57 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 6593593..565b921 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,65 +1,25 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/ ; + proxy_pass http://127.0.0.1:__PORT__; + proxy_set_header Host $host; + 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 https; + proxy_http_version 1.1; + proxy_redirect off; - # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file - #client_max_body_size 50M; - - - # store responses to anonymous users for up to 1 minute - proxy_cache bookwyrm_cache; - proxy_cache_valid any 1m; - add_header X-Cache-Status $upstream_cache_status; - - # ignore the set cookie header when deciding to - # store a response in the cache - proxy_ignore_headers Cache-Control Set-Cookie Expires; - - # PUT requests always bypass the cache - # logged in sessions also do not populate the cache - # to avoid serving personal data to anonymous users - proxy_cache_methods GET HEAD; - proxy_no_cache $cookie_sessionid; - proxy_cache_bypass $cookie_sessionid; - - # tell the web container the address of the outside client - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header Host $host; - proxy_redirect off; - - location ~ ^/(login[^-/]|password-reset|resend-link|2fa-check) { - limit_req zone=loginlimit; - proxy_pass http://127.0.0.1:__PORT__; - } - - # do not log periodic polling requests from logged in users - location /api/updates/ { - access_log off; - proxy_pass http://127.0.0.1:__PORT__; - } - - location / { - proxy_pass http://127.0.0.1:__PORT__; - } - - try_files $uri $uri/ index.php; - location ~ ^/(images|static)/ { - root /app; - try_files $uri =404; - add_header X-Cache-Status STATIC; - access_log off; - } - - # monitor the celery queues with flower, no caching enabled - location /flower/ { - proxy_pass http://flower:8888; - proxy_cache_bypass 1; - } - -### End of PHP configuration part + # For WebSocket + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + # Cache settings + #proxy_cache cache1; + proxy_cache_lock on; + proxy_cache_use_stale updating; + more_set_headers "X-Cache: $upstream_cache_status"; + # Change to upload limit + client_max_body_size 80m; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; }