云计算:LNMP网站架构,前期准备,安装php,安装MySQL
准备工作(初始化)1.关闭防火墙
systemctl disable firewalld --now //直接永久关闭防火墙
2.关闭SELINUX
查看SELINUX:getenforce
永久关闭:
# vim /etc/selinux/config
SELINUX=enforcing|disabled
或者
# sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
3.修改主机名
root@localhost ~]#hostnamectl set-hostname lnmp
4.安装本地yum源
root@localhost ~]#curl -o tool.sh 10.35.156.250/repo/tools.sh
root@localhost ~]#sh tool.sh
5.重启服务器
root@localhost ~]#reboot
安装nginx
#yum -y install nginx
#nginx // 启动
#ss -nplt //查看
# ss -nplt
#写一个测试页面
# rm -rf /usr/share/nginx/html/*
# echo "hello nginx" >/usr/share/nginx/html/index.html
# curl 127.0.0.1
安装php
# yum -y install php74-php-xsl php74-php php74-php-cli php74-php-devel php74-php-gd php74-php-pdo php74-php-mysql php74-php-fpm
启动php74-php-fpm
#systemctl start php74-php-fpm
查看启动状态
# ss -nplt | grep 9000
安装MySQL
整理环境
systemctl stop mysqld
yum -y remove `rpm -qa | grep mysql-community`
rm -rf /etc/my.*; rm -rf /var/log/musqld.log ;rm -rf /var/lib/mysql/
通过官方yum源安装
访问MySQL官网获取yum源(www.mysql.com)
https://i-blog.csdnimg.cn/direct/4b4a716e2c744aa39f230eb5d2c37a5f.pnghttps://i-blog.csdnimg.cn/direct/c0b16d01fc4549219407b4d28595de0e.pnghttps://i-blog.csdnimg.cn/direct/042aa9747f874691b0913cb85d3a2c34.pnghttps://i-blog.csdnimg.cn/direct/d7e5bc0c6a8a43d1968d97fd85748630.pnghttps://i-blog.csdnimg.cn/direct/45d53fd4ac184742bafcea66f8fbcb84.png下载并安装yum源
# yum -y install https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
# rpm -ivh https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
# wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
# yum -y install mysql84-community-release-el7-1.noarch.rpm
安装MySQL
# yum -y install mysql-community-server --disablerepo mysql180-community-server --enablerepo musql157-community-server
通过本地yum源安装MySQL
# yum -y install mysql-server
启动MySQL实例
# systemctl start mysqld
获取临时暗码
# grep "password " | /var/log/mysqld.log
或者
# awk '/A temporary password/{p=$NF}END{print p}' /var/log/mysqld.log
修改暗码
# mysqladmin -uroot -p"`awk '/A temporary password/{p=$NF}END{print p}' /var/log/mysqld.log`" password "123qf456@"
或者
# mysqladmin -p "临时暗码" password 123qf456@
登录数据库
#mysql -uroot -p123qf456@
创建数据库
mysql > create database wordpress(数据库名字 ) charset 'utf8';
mysql> \q
数据库安装完成后,在体系中天生的文件
1.配置文件
/etc/my.cnf //配置文件修改完一定要重启
2.日志文件
/var/log/mysql.log
3.数据目录
/var/lib/mysql/
nginx关联PHP
vim /etc/nginx/nginx.conf
//42行后参加以下内容
index index.php index.html index.htm;
location ~ \.php$
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html/$fastcgi_script_name;
}
#nginx -s reload //修改配置文件重启
# vim /usr/share/nginx/html/index.php
<?php
phpinfo();
?>
# 浏览器访问
http://192.168.199.136
发布wordpress
1、上传wordpress压缩包
rz
2、解压缩
tar -xf wordpress-6.2.2-zh_CN.tar.gz
3、拷贝至nginx根目录下
cp -r wordpress/* /usr/share/nginx/html/
4、修改权限
chown -R nginx.nginx /usr/share/nginx/html/
chmod -R 777 /usr/share/nginx/html/
5、浏览器安装
最后添加一个下令,寻找目录或文件所在位置,很实用
# find / -name php.ini
/etc/opt/remi/php74/php.ini
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页:
[1]