我在迁移Chereveto并开始使用nginx-tengine时,出现了无法访问的情况(错误代码404)

这篇文章可以解决nginx使用Chereveto出现的404问题

在网站配置文件最后一行的 “}” 前加入如下代码

# Disable access to .ht* files
location ~ /\.ht {
    deny all;
}

# Disable access to sensitive files in app path
location ~ /(app|content|lib)/.*\.(po|php|lock|sql)$ {
   deny all;
}

# Disable log on not found images + image replacement
location ~* (jpe?g|png|gif) {
    log_not_found off;
    error_page 404 /content/images/system/default/404.gif;
}

# Enable CORS header (needed for CDN)
location ~* \.(ttf|ttc|otf|eot|woff|woff2|css|js)$ {
    add_header Access-Control-Allow-Origin "*";
}

# Force serve upload path as static content (match your upload folder if needed)
location /images {}

# Route dynamic request to index.php
location / {
    try_files $uri $uri/ /index.php?$query_string;
}

就是这么简单QAQ


Just Kaede!