Mingc-Lu
轻舟已过万重山,云淡风轻吧。

安装WordPress

买了新的阿里云服务器解决新网服务器150m没有ssh的限制。装的纯镜像ubuntu20.4

以下是安装并设置Wordpress nginx mysql php的步骤:

更新源

apt-get update && apt-get install wget curl nano libgd3 -y

安装nginx

apt install nginx -y

systemctl reload nginx

下一步访问网站ip地址查看nginx出现下面的网页表示正常不正常我也没办法费脑细胞

添加软件包 一个固定搭配

apt install software-properties-common 

安装php8.2

添加软件源 弹出窗口按回车

add-apt-repository ppa:ondrej/php

安装php8.2和搭配包

apt install php8.2 && php8.2-fpm -y

这里我们用nginx,删掉apache2

apt autoremove apache2 –purge -y

检查php版本

php -v

nano编辑器编辑默认文件退出按ctrl+x  

y保存/ n不修改文件

nano/etc/nginx/sites-available/default

server {

        listen 80 default_server;

        listen [::]:80 default_server;

        root /var/www/html;

        # Add index.php to the list if you are using PHP

        index index.php index.html index.htm index.nginx-debian.html;

        server_name <IP地址>;  

location / {

                try_files $uri $uri/ /index.php$is_args$args;

        }

        location ~ \.php$ {

                include snippets/fastcgi-php.conf;

                fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;

        }

        location = /favicon.ico { log_not_found off; access_log off; }

        location = /robots.txt { log_not_found off; access_log off; allow all; }

        location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {

        expires max;

        log_not_found off;

        }

}

检查配置是否错误: nginx -t

重启nginx

systemctl reload nginx

测试PHP与Nginx集成成功

html目录下新建info.php文件 /var/www/html/info.php

nano /var/www/html/info.php 

内容为:

<?php 

phpinfo();

访问http://IP地址/info.php

出现一个php介绍的页面就是正常的!

开始下一步

安装数据库mysql 

安装mysql

apt install nginx mysql-server-8.0 php8.2-mysql -y

数据库设置

mysql -uroot

创建Wordpress数据库

create database WordPress;

创建用户密码

create user ‘game’@’localhost’ identified by ‘Lyc19980212’;

给用户操作Wordpress库的权限

GRANT ALL PRIVILEGES ON `wordpress`.* TO `game`@`localhost`;

更新

flush privileges;

退出

exit

下载Wordpress

wget https://cn.wordpress.org/latest-zh_CN.tar.gz

#解压

tar -zxvf latest-zh_CN.tar.gz 

#挪到web专用目录去

mv wordpress/ /var/www/html/

#mingc-lu.com/wordpress调整权限

chmod -R 755 /var/www/html/

chown -R www-data:www-data /var/www/html/

浏览器输入ip/Wordpress就可以进入安装界面

数据表名 账户密码 填上面数据库里面的配置