安装nginx

1
2
3
4
5
6
7
8
9
sudo apt-get install nginx
# 增加开机启动
systemctl start nginx
systemctl enable nginx
# 查看启动状态
systemctl status nginx.service

浏览器查看
http://服务器IP地址

安装mysql

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sudo apt-get install mysql-server

# 增加开机启动
systemctl start mysql
systemctl enable mysql

sudo systemctl status mysql.service

sudo mysql_secure_installation
# 选择密码难度等级

# 不能设置密码 配置密码
sudo mysql
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'HNcs123456';

密码:
HNcs123456.

如果错误

安装php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
,Nginx 没有对处理 PHP 文件的内建支持。我们将会使用 PHP-FPM (“fastCGI process manager”) 来处理 PHP 文件。

sudo apt install php
sudo apt install php-fpm

systemctl start php7.4-fpm
systemctl enable php7.4-fpm

更换php从监听socket为监听ip端口
sudo vim /etc/php/7.4/fpm/pool.d/www.conf

注释掉sock一行
; listen = /run/php/php7.4-fpm.sock
listen = 127.0.0.1:9000

保存退出,重启fpm
sudo systemctl restart php7.4-fpm


sudo vim /etc/nginx/nginx.conf
目录更改为保留一个
include /etc/nginx/conf.d/*.conf;
# include /etc/nginx/sites-enabled/*;

查看Nginx版本号
sudo nginx -v

启动Nginx
sudo nginx

关闭Nginx
sudo nginx -s stop

重加载Nginx(重新加载配置文件)
sudo nginx -s reload

重启
sudo nginx -s reopen

Nginx配置文件位置
/usr/local/nginx/conf/nginx.conf
/etc/nginx/nginx.conf

创建数据库

登录root
mysql -u root -p

执行以下命令,创建一个新的数据库。
CREATE DATABASEwordpress

执行以下命令,为数据库创建用户并为用户分配数据库的完全访问权限。
<!-- GRANT ALL ON wordpress.* TO Ai_xuan@localhost IDENTIFIED BY'Ai_xuan123.';
#utf-8创建
CREATE DATABASE IF NOT EXISTS wordpress DEFAULT CHARSET utf8 COLLATE utf8_general_ci;

grant all privileges on wordpress.* to Ai_xuan@localhost identified by '123456'; -->

其中,“Ai_xuan”为数据库用户名,“Ai_xuan123.”为对应的帐户密码,可以自行设置。
切换数据库
use wordpress
创建用户
create user Ai_xuan@localhost identified by 'Ai_xuan123456.';
刷新
flush privileges;


exit
验证:
mysql -u Ai_xuan -p

SHOW DATABASES



exit

备案号代码

//通用代码如下:
<a href="https://beian.miit.gov.cn/" target="_blank">您的备案号</a>

//示例代码如下:
<a href="https://beian.miit.gov.cn/" target="_blank">浙B2-20080101</a>