我用的是ubuntu20.04,相关的php依赖包是7.4
我安装的php依赖包如下:
root@Desktop:/home/appleyuchi# dpkg --list|grep php
依赖包名称 | 版本号 | 支持的硬件架构 | 依赖包说明 |
---|---|---|---|
php-common | 2:75 | all | Common files for PHP packages |
php-fpm | 2:7.4+75 | all | server-side, HTML-embedded scripting language (FPM-CGI binary) (default) |
php-gd | 2:7.4+75 | all | GD module for PHP [default] |
php-mysql | 2:7.4+75 | all | MySQL module for PHP [default] |
php7.4-cli | 7.4.3-4ubuntu2.3 | amd64 | command-line interpreter for the PHP scripting language |
php7.4-common | 7.4.3-4ubuntu2.3 | amd64 | documentation, examples and common module for PHP |
php7.4-fpm | 7.4.3-4ubuntu2.3 | amd64 | server-side, HTML-embedded scripting language (FPM-CGI binary) |
php7.4-gd | 7.4.3-4ubuntu2.3 | amd64 | GD module for PHP |
php7.4-json | 7.4.3-4ubuntu2.3 | amd64 | JSON module for PHP |
php7.4-mysql | 7.4.3-4ubuntu2.3 | amd64 | MySQL module for PHP |
php7.4-opcache | 7.4.3-4ubuntu2.3 | amd64 | Zend OpCache module for PHP |
php7.4-readline | 7.4.3-4ubuntu2.3 | amd64 | readline module for PHP |
所以不同的ubuntu有不同的php依赖包版本,不要照抄我的,根据自己的版本号来做相应的修改
浏览器访问 | 网页报错 | /etc/nginx/error.log报错 | 解决方案 |
---|---|---|---|
http://localhost:80/wp-admin/install.php | 502 | connect() to unix:/var/run/php/php7.1-fpm.sock failed (2: No such file or directory) | nginx.conf中/var/run/php/php7.1-fpm.sock;/var/run/php/php7.4-fpm.sock然后nginx -s reload |
登陆之后 | 404 | [error] 500558#500558: *127 “/usr/share/nginx/html/wp-admin/index.php” is not found (2: No such file or directory), client: 127.0.0.1, server: localhost, request: “GET /wp-admin/ HTTP/1.1”, host: “localhost”, referrer: “http://localhost/wp-login.php” |
是否需要编译版本的nginx
另外,网上有博主说需要自己编译nginx,
这个可用可不用,我们用自带的就好了.
文件结构
(Python3.6) appleyuchi@Desktop:~/wordpress$ ls
hello.php wp-admin wp-cron.php wp-settings.php
…
…
nginx文件
对应的完整的/etc/nginx/nginx.conf
server {
listen 80;
listen [::]:80;
server_name localhost;
root /home/appleyuchi/wordpress;
#location /
#{
#try_files $uri $uri/ /index.php?$query_string;
#}
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$
{
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
#location /wp-includes {
#root /home/appleyuchi/wordpress/wp-includes;
#autoindex on;
# }
}