1、打开网址:http://www.aaaacn.net/wp-admin/install.php,报错:HTTP ERROR 500,如图1
2、打开网址:http://www.aaaacn.net/phpinfo.php,正常运行,如图2
3、查看 Virtualhost conf:/usr/local/nginx/conf/vhost/www.aaaacn.net.conf
server { listen 80; server_name www.aaaacn.net aaaacn.net; access_log /data/wwwlogs/www.aaaacn.net_nginx.log combined; index index.html index.htm index.php; root /data/wwwroot/www.aaaacn.net; if ($host != www.aaaacn.net) { return 301 $scheme://www.aaaacn.net$request_uri; } include /usr/local/nginx/conf/rewrite/wordpress.conf; #error_page 404 /404.html; #error_page 502 /502.html; location ~ [^/]/.php(/|$) { #fastcgi_pass remote_php_ip:9000; fastcgi_pass unix:/dev/shm/php-cgi.sock; fastcgi_index index.php; include fastcgi.conf; } location ~ .*/.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { expires 30d; access_log off; } location ~ .*/.(js|css)?$ { expires 7d; access_log off; } location ~ //.ht { deny all; } }
4、查看 Rewrite rule:/usr/local/nginx/conf/rewrite/wordpress.conf
location / { try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~* ^/wp-content/uploads/.*/.php$ { deny all; }
5、查看目录权限,发现 WordPress 目录中的文件,权限用户和用户组,一些已经不是 www,而是 root,应该是因为 WordPress 目录中的文件,是 root 用户复制所导致的,如图3
6、出现文件权限问题时,依次执行下面 3 条命令,设置权限用户和用户组为 www,将整个 /data/wwwroot/ 目录重新设置,如图4
chown -R www.www /data/wwwroot/ find /data/wwwroot/ -type d -exec chmod 755 {} /; find /data/wwwroot/ -type f -exec chmod 644 {} /;
7、编辑 /data/wwwroot/www.aaaacn.net/wp-config.php,设置身份认证密钥与盐,如图5
8、在整个 WordPress 中触发“调试”模式,编辑 /data/wwwroot/www.aaaacn.net/wp-config.php
define('WP_DEBUG', true); define( 'WP_DEBUG_LOG', true );
9、设置是否将错误信息作为输出的一部分显示到屏幕,设置为是,编辑 /data/wwwroot/www.aaaacn.net/wp-admin/install.php,在 phpinfo 中这两项是关闭的,如图6
error_reporting(-1); ini_set('display_errors', '1'); ini_set('log_errors', '1');
10、打开网址:http://www.aaaacn.net/wp-admin/install.php,报错:HTTP ERROR 500 的详细信息出现,如图7
Warning: require(/data/wwwroot/www.aaaacn.net/wp-includes/load.php): failed to open stream: No such file or directory in /data/wwwroot/www.aaaacn.net/wp-settings.php on line 19 Warning: require(/data/wwwroot/www.aaaacn.net/wp-includes/load.php): failed to open stream: No such file or directory in /data/wwwroot/www.aaaacn.net/wp-settings.php on line 19 Fatal error: require(): Failed opening required '/data/wwwroot/www.aaaacn.net/wp-includes/load.php' (include_path='.:/usr/local/php/lib/php') in /data/wwwroot/www.aaaacn.net/wp-settings.php on line 19
11、分析:/data/wwwroot/www.aaaacn.net/wp-includes/load.php,文件不存在,如图8
12、决定删除 /data/wwwroot/www.aaaacn.net 中的所有文件,重新下载安装包,解压后复制至 /data/wwwroot/www.aaaacn.net,检查 load.php 已经存在,设置权限用户和用户组为 www,如图9
wget https://cn.wordpress.org/latest-zh_CN.tar.gz tar -xzvf latest-zh_CN.tar.gz cp -rf /root/wordpress/* /data/wwwroot/www.aaaacn.net chown -R www.www /data/wwwroot/ find /data/wwwroot/ -type d -exec chmod 755 {} /; find /data/wwwroot/ -type f -exec chmod 644 {} /;
13、打开网址:http://www.aaaacn.net/wp-admin/install.php,正常,符合预期,不确定之前为何解压后 load.php 会丢失?如图10
原创文章,作者:3628473679,如若转载,请注明出处:https://blog.ytso.com/181326.html