diff --git a/conf/nginx.conf b/conf/nginx.conf index 4634c6e..9a9b78c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,6 +4,18 @@ location = /.well-known/carddav { location = /.well-known/caldav { return 301 https://$server_name__PATH__/remote.php/dav; } +location = /.well-known/host-meta { + return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta; +} +location = /.well-known/host-meta.json { + return 301 $scheme://$host:$server_port__PATH__/public.php?service=host-meta-json; +} +location = /.well-known/webfinger { + return 301 $scheme://$host:$server_port__PATH__/public.php?service=webfinger; +} +location = /.well-known/nodeinfo { + return 301 $scheme://$host:$server_port__PATH__/public.php?service=nodeinfo; +} #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location ^~ __PATH__/ { @@ -41,11 +53,6 @@ location ^~ __PATH__/ { error_page 403 __PATH__/core/templates/403.php; error_page 404 __PATH__/core/templates/404.php; - # The following 2 rules are only needed for the user_webfinger app. - # Uncomment it if you're planning to use this app. - #rewrite ^/.well-known/host-meta __PATH__/public.php?service=host-meta last; - #rewrite ^/.well-known/host-meta.json __PATH__/public.php?service=host-meta-json last; - location __PATH__/ { rewrite ^ __PATH__/index.php; } @@ -63,26 +70,50 @@ location ^~ __PATH__/ { deny all; } - location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+|ocm-provider/.+)\.php(/.*|)$ { - include fastcgi_params; - fastcgi_split_path_info ^(.+\.php)(/.+)$; + location ~ ^__PATH__/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+)\.php(?:$|/)$ { + fastcgi_split_path_info ^(.+?\.php)(/.*|)$; + set $path_info $fastcgi_path_info; try_files $fastcgi_script_name =404; - fastcgi_param SCRIPT_FILENAME $request_filename; - fastcgi_param PATH_INFO $fastcgi_path_info; + include fastcgi_params; + + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $path_info; fastcgi_param HTTPS on; + # Avoid sending the security headers twice fastcgi_param modHeadersAvailable true; - fastcgi_param REMOTE_USER $remote_user; + # Enable pretty urls + fastcgi_param front_controller_active true; fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__NAME__.sock; fastcgi_intercept_errors on; + fastcgi_request_buffering off; + fastcgi_param REMOTE_USER $remote_user; } - location ~ ^__PATH__/(?:updater|ocs-provider|ocm-provider)(?:$|/) { + location ~ ^__PATH__/(?:updater|oc[ms]-provider)(?:$|/) { try_files $uri/ =404; index index.php; } + location = __PATH__/core/js/oc.js { + rewrite ^ /index.php$request_uri; + } + + location = __PATH__/core/preview.png { + rewrite ^ /index.php$request_uri; + } + + location ~* ^__PATH__/(?:css|js)/ { + rewrite ^ /index.php$request_uri; + } + + location ~* ^__PATH__/apps/theming/img/core/filetypes/ { + rewrite ^ /index.php$request_uri; + } + + + # Adding the cache control header for js and css files - location ~ ^__PATH__/.+[^/]\.(?:css|js|woff2?|svg|gif)$ { + location ~ \.(?:css|js|woff2?|svg|gif)$ { try_files $uri __PATH__/index.php$request_uri; more_set_headers "Cache-Control: public, max-age=15778463"; # Add headers to serve security related headers @@ -98,7 +129,8 @@ location ^~ __PATH__/ { access_log off; } - location ~* \.(?:png|html|ttf|ico|jpg|jpeg)$ { + location ~* \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ { + try_files $uri /index.php$request_uri; # Optional: Don't log access to other assets access_log off; }