基于上文配置好的LNMP环境继续搭建wordpress
目录
一.到官网下载tar.gz包,并上传到Linux上,也可以通过复制链接地址进行下载
二. 将wordpress中的所有文件移动到你nginx.conf中指定目录中
三.为wordpress配置数据库
四.到浏览器进行注册
1.刚开始可以用ip/wp-admin/index.php进行引导
2.跳转后填写信息
3.弹出这个界面,就复制一份wp-config.php文件
4.输入信息
5.登录
6.问题解决,登录后台报404
(1)方法1
(2)方法2
五.手动添加用户
1.点击用户添加,输入相关信息
2.邮箱会收到信息, 后续也可以使用这个账号登录 编辑
3.查看数据库里是否有用户信息
[root@localhost ~]# tar -zvxf wordpress-4.8-zh_CN.tar.gz
[root@localhost ~]# mv wordpress/* /usr/local/src/nginx-1.22.0/html/
[root@localhost html]# ll
total 200
-rwxr-xr-x 1 nginx nginx 497 May 24 2022 50x.html
-rwxr-xr-x 1 nginx nginx 615 May 24 2022 index.html
-rwxr-xr-x 1 nobody nfsnobody 418 Sep 25 2013 index.php
-rwxr-xr-x 1 nobody nfsnobody 19935 Jan 3 2017 license.txt
-rwxr-xr-x 1 root root 21 Aug 12 10:31 phpinfo.php
-rwxr-xr-x 1 nobody nfsnobody 6956 Jul 23 2017 readme.html
-rwxr-xr-x 1 nobody nfsnobody 5447 Sep 28 2016 wp-activate.php
drwxr-xr-x 9 nobody nfsnobody 4096 Jul 23 2017 wp-admin
-rwxr-xr-x 1 nobody nfsnobody 364 Dec 19 2015 wp-blog-header.php
-rwxr-xr-x 1 nobody nfsnobody 1627 Aug 29 2016 wp-comments-post.php
-rwxr-xr-x 1 root root 2910 Aug 12 21:22 wp-config.php
-rwxr-xr-x 1 nobody nfsnobody 2910 Aug 12 21:22 wp-config-sample.php
drwxr-xr-x 5 nobody nfsnobody 69 Jul 23 2017 wp-content
-rwxr-xr-x 1 nobody nfsnobody 3286 May 25 2015 wp-cron.php
drwxr-xr-x 18 nobody nfsnobody 8192 Jul 23 2017 wp-includes
-rwxr-xr-x 1 nobody nfsnobody 2422 Nov 21 2016 wp-links-opml.php
-rwxr-xr-x 1 nobody nfsnobody 3301 Oct 25 2016 wp-load.php
-rwxr-xr-x 1 nobody nfsnobody 34327 May 13 2017 wp-login.php
-rwxr-xr-x 1 nobody nfsnobody 8048 Jan 11 2017 wp-mail.php
-rwxr-xr-x 1 nobody nfsnobody 16200 Apr 7 2017 wp-settings.php
-rwxr-xr-x 1 nobody nfsnobody 29924 Jan 24 2017 wp-signup.php
-rwxr-xr-x 1 nobody nfsnobody 4513 Oct 15 2016 wp-trackback.php
-rwxr-xr-x 1 nobody nfsnobody 3065 Sep 1 2016 xmlrpc.php
[root@localhost ~]# mysql -uroot -p123456
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.6.14-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]> create database wordpress default character set utf8;
Query OK, 1 row affected (0.001 sec)
MariaDB [(none)]> create user wordpress@localhost identified by "123456";
Query OK, 0 rows affected (0.002 sec)
MariaDB [(none)]> grant all privileges on *.* to wordpress@localhost;
Query OK, 0 rows affected (0.001 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.001 sec)
主要是填写刚才创建的数据库信息DB_NAME,DB_USER,DB_PASSWORD,DB_HOST,点击进行安装
[root@localhost html]# cp wp-config-sample.php wp-config.php
[root@localhost html]# vim wp-config.php
我这里没有跳到后台而是跳回wp-admin并报404,直接通过IP/wp-admin也是报404
到这里其实我们的信息都已经注册好了,可以和第一步一样直接通过ip/wp-admin/index.php登录
修改nginx.conf配置
[root@localhost conf]# vim nginx.conf
将这部分的工作目录更改到和php部分一直,并添加index.php
更改后的内容
重启nginx,通过ip/wp-admin进入后台
Database changed
MariaDB [wordpress]> show tables;
+-----------------------+
| Tables_in_wordpress |
+-----------------------+
| wp_commentmeta |
| wp_comments |
| wp_links |
| wp_options |
| wp_postmeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_termmeta |
| wp_terms |
| wp_usermeta |
| wp_users |
+-----------------------+
12 rows in set (0.000 sec)
MariaDB [wordpress]> select * from wp_users;
+----+------------+------------------------------------+---------------+---------------------+----------+---------------------+-----------------------------------------------+-------------+--------------+
| ID | user_login | user_pass | user_nicename | user_email | user_url | user_registered | user_activation_key | user_status | display_name |
+----+------------+------------------------------------+---------------+---------------------+----------+---------------------+-----------------------------------------------+-------------+--------------+
| 1 | su | $P$BKXqDGFNyKlDuc5PhCWFz.rSw6i/mo0 | su | [email protected] | | 2023-08-12 14:25:31 | | 0 | su |
| 2 | qwe | $P$Be3x8/Et/cnjTymICFYPKqRpjsSjrD/ | qwe | [email protected] | | 2023-08-12 14:52:09 | 1691851929:$P$Bn49MnVV16FhF3a0Na0H32GvDRirDM1 | 0 | l, lklk |
+----+------------+------------------------------------+---------------+---------------------+----------+---------------------+-----------------------------------------------+-------------+--------------+
2 rows in set (0.000 sec)