Skip to content

Commit

Permalink
Fix for livewire routes
Browse files Browse the repository at this point in the history
  • Loading branch information
robsontenorio committed Jul 26, 2023
1 parent c015a7a commit 3cfbcfc
Showing 1 changed file with 22 additions and 26 deletions.
48 changes: 22 additions & 26 deletions config/etc/nginx/sites-available/default
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,45 @@ server {
listen [::]:8080 default_server;
listen 8080 default_server;
server_name _;

# sendfile off;
client_max_body_size 16m;


root /var/www/app/public;
index index.php index.html;

charset utf-8;
client_max_body_size 16m;

error_page 404 /index.php;

location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }

# Default
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.php
try_files $uri $uri/ /index.php?$query_string;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/lib/nginx/html;
# Prevent cache JS for livewire routes, and make it as a normal route
location ^~ /livewire {
try_files $uri $uri/ /index.php?$query_string;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
# PHP
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/home/appuser/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_index index.php;
fastcgi_pass unix:/home/appuser/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}

# Prevent access "." files
location ~ /\.(?!well-known).* {
deny all;
}

# Cache
location ~* \.(ico|css|js|gif|jpeg|jpg|png|woff|ttf|otf|svg|woff2|eot)$ {
expires 5d;
}

# deny access to . files, for security
#
location ~ /\. {
log_not_found off;
deny all;
}

# Enable gzip
gzip on;
gzip_vary on;
Expand Down

0 comments on commit 3cfbcfc

Please sign in to comment.