【问题标题】:UserFrosting Nginx asset-raw 404UserFrosting Nginx 资产原始 404
【发布时间】:2019-05-12 12:14:56
【问题描述】:

我正在使用 Nginx 而我没有使用 Apache。 所以需要一段Nginx代码来解决前端静态资源的加载问题。

我的问题类似于this,但我不是Apache。 我没有在“webserver-configs”文件夹中找到我想要的东西。

以下代码似乎不起作用。

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;
}

【问题讨论】:

标签: nginx stylesheet userfrosting


【解决方案1】:

下面的Nginx规则配置代码可以正确解决上述问题。

✔经过我的实际测试。

  ## 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

【讨论】:

    猜你喜欢
    • 2021-06-22
    • 1970-01-01
    • 1970-01-01
    • 2012-09-03
    • 2020-07-30
    • 2019-09-23
    • 1970-01-01
    • 1970-01-01
    • 2014-07-24
    相关资源
    最近更新 更多