Lnmp环境安装typecho wordpress博客
安装PHP7.4
一、添加EPEL和REMI存储库
EPEL和REMI存储库是此安装的主要要求,通过运行以下命令将它们添加到系统:
sudo yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
sudo dnf -y install dnf-utils
yum search php74*
yum install php74-php
yum install php74-php-mysqlnd.x86_64
php74 -v
#重启命令php-fpm
systemctl restart php74-php-fpm
#添加自动启动
systemctl enable php74-php-fpm
#查看php7.4的安装路径
whereis php
#链接php文件
ln -s /opt/remi/php74/root/usr/bin/php /usr/bin/php
srw-rw-rw-+ 1 root root /var/opt/remi/php74/run/php-fpm/www.sock 权限666
vim /etc/opt/remi/php74/php-fpm.d/www.conf
修改这几处
user = nginx
group = nginx
listen = /var/opt/remi/php74/run/php-fpm/www.sock
listen.owner = nginx
listen.group = nginx
listen.mode = 0666
安装Nginx
yum install nginx -y
nginx.conf 配置支持PHP
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
# The default server
#
server {
listen 443 ssl;
server_name hqq365.com;
root /usr/share/nginx/html;
index index.php;
#####ssl证书
ssl_certificate /etc/nginx/hqq365.com_nginx/hqq365.com_bundle.crt;
ssl_certificate_key /etc/nginx/hqq365.com_nginx/hqq365.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
###nginx支持PHP
location ~ .*\.php(\/.*)*$ { #pathinfo 的支持,对于 typecho 这个是必须有的不然typecho文章会点不开
root /usr/share/nginx/html;
fastcgi_pass unix:/var/opt/remi/php74/run/php-fpm/www.sock; # unix启动
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
####80端口重定向https://
server {
listen 80;
server_name hqq365.com;
rewrite ^(.*)$ https://${server_name}$1 permanent;
}
}
网站根目录html 设置为nginx用户
安装Mysql数据库
yum install mysql-server -y
systemctl start mysqld
centos8 默认没有密码进入mysql
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password'; #设置root数据库密码
安装wordpress
下载wordpress软件
创建数据库和用户名
create database wordpress;
create user skyhu@localhost identified by "123456";
grant all privileges to wordpress.* on skyhu@localhost;
安装typecho博客
下载typecho软件
创建数据库和用户名
create database typecho;
create user skyhu@localhost identified by "123456";
grant all privileges to typecho.* on skyhu@localhost;