关于环境:
vi /etc/sysconfig/network-scripts
onboot——>yes
systemctl start network
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
yum -y install bash-completion
yum -y install wget unzip
yum -y install epel-release
yum -y update
yum -y install nginx
systemctl enable nginx
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php72w-tidy php72w-common php72w-devel php72w-pdo php72w-mysqlnd php72w-gd php72w-ldap php72w-mbstring php72w-mcrypt php72w-fpm php-redis
systemctl enable php-fpm.service
systemctl start php-fpm.service
yum -y install vim
配置NGINX文件
cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
vim /etc/nginx/nginx.conf
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
include /etc/nginx/default.d/*.conf;
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 5503 504 /50x.html;
location = /50x.html {
}
location / {
root /usr/share/nginx/html;
index index.php index.html index.htm;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
}
nginx -t -c /etc/nginx/nginx.conf
systemctl start nginx
nginx常见配置问题
vim /etc/selinux/config
reboot
systemctl status nginx
着手部署wordpress
cd /usr/share/nginx/html/
wget https://wordpress.org/wordpress-5.4.10.zip
unzip wordpress-5.4.10.zip
chmod -R 777 wordpress
cd wordpress
cp wp-config-sample.php wp-config.php
mysql数据库服务安装
yum list installed grep mariadb64
yum list installed grep mariadb_64
cd /usr/local
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.43-linux-glibc2.12-x86_64.tar.gz
tar -xvf mysql-5.7.43-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.7.43-linux-glibc2.12-x86_64 mysql-5.7
cd mysql-5.7
mkdir conf
cd conf
vim my.cnf
[client]
port=3306
[mysql]
default-character-set=utf8
[mysqld]
port=3306
basedir=/usr/local/mysql-5.7
datadir=/usr/local/mysql-5.7/data
character-set-server=utf8
default-storage-engine=INNODB
max_connections=500
socket=/usr/local/mysql-5.7/mysql.sock
symbolic-links=0
log-error=/usr/local/mysql-5.7/logs/mysql_log.log
pid-file=/usr/local/mysql-5.7/mysqld.pid
lower_case_table_names=1
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
adduser mysql
passwd mysql
groupadd mysql
useradd -g mysql mysql
chown -R mysql.mysql /usr/local/mysql-5.7
cd /usr/local/mysql-5.7/bin
./mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql-5.7 --datadir=/usr/local/mysql-5.7/data
设置开机启动
vim /usr/lib/systemd/system/mysql.service
[Unit]
Description=MySQL Server 5.7
Documentation=http://dev.mysql.com/doc/refman/en/using-systemd.html
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
User=mysql
Group=mysql
ExecStart=/usr/local/mysql-5.7/bin/mysqld --defaults-file=/usr/local/mysql-5.7/conf/my.cnf
LimitNOFILE = max_open_files
systemctl enable mysql.service
systemctl start mysql.service
systemctl stop mysql.service
systemctl restart mysql.service
systemctl list-units --type=service
systemctl status mysql.service
systemctl enable mysql.service
systemctl disable mysql.service
find / -name mysql.server
cp /usr/local/mysql-5.7/support-files/mysql.server /etc/init.d/mysql
cat /usr/local/mysql-5.7/conf/my.cnf
vim /etc/init.d/mysql
粘贴
service mysql start
启动连接
systemctl start mysql.service
cd /usr/local/mysql-5.7/bin
./mysql -uroot -h 127.0.0.1 -p
use mysql
show databases;
update user set authentication_string=PASSWORD("kingso616") where user='root';
flush privileges;
update user set host='%' where user='root';
flush privileges;
CREATE DATABASE 数据库名;
drop database 数据库名;
继续修改WP的配置文件
vim /usr/share/nginx/html/wordpress/wp-config.php
define( 'DB_NAME', 'database_name_here' );
/** MySQL database username */
define( 'DB_USER', 'username_here' );
/** MySQL database password */
define( 'DB_PASSWORD', 'password_here' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
define("FS_METHOD","direct");
define("FS_CHMOD_DIR",0777);
define("FS_CHMOD_FILE",0777);
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
systemctl restart nginx php-fpm
网站带路径
REDIS的安装部署
mkdir /usr/local/redis
cd 之
yum install wget
wget http://download.redis.io/redis-stable.tar.gz
tar -zxvf redis-stable.tar.gz
make
wget https://sourceforge.net/projects/tcl/files/Tcl/8.6.13/tcl8.6.13-src.tar.gz
tar -zxvf tc_tab
cd /usr/local/tc_tab/unix/
./configure
make
make install
以上多半会因为gcc版本过低而无法完成test,尝试用以下方式解决
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
make distclean
make install
cat redis.conf.bak | grep -v "#" | grep -v "^$" > redis.conf
daemonize
bind 127.0.0.1 前面添加
修改 requirepass 配置,该配置表示登录该 Redis 实例所需的密码
由于上面我们配置了密码登录,这里将 protected-mode 设置为 no 关闭保护模式
redis-server
redis-server conf/redis-6379.conf
yum -y install epel-release
yum -y update
systemctl start redis
systemctl status redis
systemctl stop redis 停止服务
ps -ef | grep redis 查看reids服务信息
systemctl enable redis redis开机启动
vim /etc/redis.conf
注释
修改 protected-mode no
修改 daemonize yes
增加 requirepass password
systemctl restart redis
WP设置redis插件
执行php -m|grep redis,如返回redis则继续,否则,执行yum -y install php-redis
vim /etc/php.ini 在任意位置增加 extension=redis
vim /usr/share/nginx/html/wordpress/wp-config.php
第二段
define("WP_REDIS_HOST",'10.16.16.136');
define("WP_REDIS_PORT",'6379');
define("WP_REDIS_PASSWORD",'kingso616');