Просмотр исходного кода

Configure Nginx to handle Livewire v3 asset requests (#5260)

* Configure Nginx to handle Livewire v3 asset requests

Add location block for dynamic Livewire v3 assets in Nginx config

* Add location block for Livewire assets in Nginx config

For non ssl websites

* Refactor Livewire location block in nginx config

Keep config same as .stpl format

---------

Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
AFS 1 день назад
Родитель
Сommit
6f4db930fe

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/laravel.stpl

@@ -44,6 +44,11 @@ server {
 	location / {
 	location / {
 		try_files $uri $uri/ /index.php?$args;
 		try_files $uri $uri/ /index.php?$args;
 
 
+		location ~* ^/livewire-[^/]+/.*\.(js|css)$ {
+				expires off;
+				try_files $uri $uri/ /index.php?$query_string;
+		}
+
 		location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
 		location ~* ^.+\.(ogg|ogv|svg|svgz|swf|eot|otf|woff|woff2|mov|mp3|mp4|webm|flv|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|bmp|mid|midi|wav|rtf|css|js|jar)$ {
 			expires 30d;
 			expires 30d;
 			fastcgi_hide_header "Set-Cookie";
 			fastcgi_hide_header "Set-Cookie";

+ 5 - 0
install/deb/templates/web/nginx/php-fpm/laravel.tpl

@@ -48,6 +48,11 @@ server {
 				try_files $uri $uri/ /index.php?$query_string;
 				try_files $uri $uri/ /index.php?$query_string;
 		}
 		}
 
 
+		location ~* ^/livewire-[^/]+/.*\.(js|css)$ {
+				expires off;
+				try_files $uri $uri/ /index.php?$query_string;
+		}
+
 		location ~ [^/]\.php(/|$) {
 		location ~ [^/]\.php(/|$) {
 			try_files $uri =404;
 			try_files $uri =404;