1

I am using Nginx and I am not using Apache. So I need a piece of Nginx code to solve the loading problem of the front-end static resources.

My problem is similar to this, but I am not Apache. I didn't find what I wanted in the 'webserver-configs' folder.

The following code does not seem to work.

location ~* \.(png|gif|jpg|jpeg|svg|ico|css|js|woff|ttf|otf|woff2|eot)$ {
  index index.php;
  try_files $uri $uri/member/public/asset-raw/ member/public/index.php?$query_string;
}
张成林
  • 11
  • 3
  • Looks like this has been addressed on the forums: https://forums.userfrosting.com/t/userfrosting-nginx-asset-raw-404/539 – alexw May 14 '19 at 19:40
  • In progress, I will come up with the results after the resolution is completed. – 张成林 May 15 '19 at 02:58

1 Answers1

0

The following Nginx rule configuration code can correctly solve the above problem.

✔ After my actual test.

  ## Begin - UserFrosting Caching static files
  location ~* \/member\/.*\.(png|gif|jpg|jpeg|svg|ico|css|js|woff|ttf|otf|woff2|eot|json)$ {
    index index.php;
    try_files $uri $uri/ /member/public/index.php?$query_string;
  }
  ## End - UserFrosting Caching static files

  ## Begin - Index
  ## for subfolders, simply adjust:
  ## `location /subfolder {`
  ## and the rewrite to use `/subfolder/index.php`
  location /member/public/ {
    index index.php;
    try_files $uri $uri/ /member/public/index.php?$query_string;
  }
  ## End - Index
张成林
  • 11
  • 3