Skip to content

Instantly share code, notes, and snippets.

@marcorieser
Last active February 13, 2019 08:23
Show Gist options
  • Save marcorieser/b74d8ef1b4618e619384e7a295b477c8 to your computer and use it in GitHub Desktop.
Save marcorieser/b74d8ef1b4618e619384e7a295b477c8 to your computer and use it in GitHub Desktop.
Laravel Valet project nginx.conf which serves remote upload files if they do not exist localy.
server {
listen 80;
server_name project.test www.project.test *.project.test;
root /;
charset utf-8;
client_max_body_size 128M;
location /41c270e4-5535-4daa-b23e-c269744c2f45/ {
internal;
alias /;
try_files $uri $uri/;
}
location / {
rewrite ^ "/Users/johndoe/.composer/vendor/laravel/valet/server.php" last;
}
access_log off;
error_log "/Users/johndoe/.config/valet/Log/nginx-error.log";
error_page 404 "/Users/johndoe/.composer/vendor/laravel/valet/server.php";
set $production https://project.ch;
set $rootFolder '/Users/johndoe/websites/project/public/';
location ~ "^/wp-content/uploads/(.*)$" {
expires 24h;
log_not_found off;
root $rootFolder;
if (-f $request_filename) {
break;
}
try_files $uri $uri/ @production;
}
location @production {
resolver 8.8.8.8;
proxy_pass $production/$uri;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass "unix:/Users/johndoe/.config/valet/valet.sock";
fastcgi_index "/Users/johndoe/.composer/vendor/laravel/valet/server.php";
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME "/Users/johndoe/.composer/vendor/laravel/valet/server.php";
}
location ~ /\.ht {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment