这篇文章上次修改于 1538 天前,可能其部分内容已经发生变化,如有疑问可询问作者。
Typecho后台404错误修复
是NGINX的伪静态的配置问题
编辑NGINX配置文件/usr/local/nginx/conf/
合理配置如下:
server
{
listen 80 default_server reuseport;
#listen [::]:80 default_server ipv6only=on;
server_name _;
index index.html index.htm index.php;
root /home/wwwroot/default;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
# include enable-php.conf;
include enable-php-pathinfo.conf;
include rewrite/other.conf;
location /nginx_status
{
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/access.log;
}
修复附件上传失败
vim /var/Typecho/Common.php
public static function isAppEngine()
{
return !empty($_SERVER['HTTP_APPNAME']) // SAE
|| !!getenv('HTTP_BAE_ENV_APPID') // BAE
|| !!getenv('HTTP_BAE_LOGID') // BAE 3.0
|| (ini_get('acl.app_id') && class_exists('Alibaba')) // ACE
|| (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) // GAE
;
}
修改为
public static function isAppEngine()
{
return false;
}
同时把typecho里的usr文件权限修改为777,就可以了。
sudo chmod -R 777 usr
没有评论