我用的是ubuntu20.04,相关的php依赖包是7.4
我安装的php依赖包如下: root@Desktop:/home/appleyuchi# dpkg --list|grep php
依赖包名称版本号支持的硬件架构依赖包说明php-common2:75allCommon files for PHP packagesphp-fpm2:7.4+75allserver-side, HTML-embedded scripting language (FPM-CGI binary) (default)php-gd2:7.4+75allGD module for PHP [default]php-mysql2:7.4+75allMySQL module for PHP [default]php7.4-cli7.4.3-4ubuntu2.3amd64command-line interpreter for the PHP scripting languagephp7.4-common7.4.3-4ubuntu2.3amd64documentation, examples and common module for PHPphp7.4-fpm7.4.3-4ubuntu2.3amd64server-side, HTML-embedded scripting language (FPM-CGI binary)php7.4-gd7.4.3-4ubuntu2.3amd64GD module for PHPphp7.4-json7.4.3-4ubuntu2.3amd64JSON module for PHPphp7.4-mysql7.4.3-4ubuntu2.3amd64MySQL module for PHPphp7.4-opcache7.4.3-4ubuntu2.3amd64Zend OpCache module for PHPphp7.4-readline7.4.3-4ubuntu2.3amd64readline module for PHP所以不同的ubuntu有不同的php依赖包版本,不要照抄我的,根据自己的版本号来做相应的修改
浏览器访问网页报错/etc/nginx/error.log报错解决方案http://localhost:80/wp-admin/install.php502connect() 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; # } }