当前位置: 首页 > news >正文

RHCE的学习(8)

动态网站 lnmp(LAMP)


解析index.php界面

(1)预配,确保服务能够被访问

systemctl stop firewalld
setenforce  0

(2)安装nginx服务

mount /dev/sr0 /mnt
cat /etc/yum.repos.d/base.repo 
dnf install nginx -y 

(3)在默认网站根路径创建index.php文件

vim /usr/share/nginx/html/index.php
cat /usr/share/nginx/html/index.php
<?phpphpinfo();
?>

(4)安装php解析程序和相关插件(+重启nginx服务)

dnf install php*  -y   # * 全部
systemctl restart nginx 

(5) 浏览器测试

http://192.168.40.131或:
http://192.168.40.131/index.php
解析界面截图

(了解)知晓以下内容(用于检查配置)

tree /etc/nginx/   #有两个重要的php文件(php.conf与php-fpm.conf)vim /etc/nginx/default.d/php.conf    
systemctl restart nginx 
systemctl status nginx
systemctl status php-fpm   #启动nginx会启动php-fpm

搭建个人博客网站--wordpress

lnmp  ==    l-linux n-nginx m-mariadb p-php

nginx的配置

cd /usr/share/nginx/html
通过文件传输方式将window下的wordpres包放在/usr/share/nginx/html路径下(xfpt)
unzip wordpress-6.5.5.zip    #解压文件vim /etc/nginx/nginx.conf    #在主配置文件修改网站根目录的路径如下
...
server {
...root /usr/share/nginx/wordpress;            
...
}
....

mariadb配置

dnf install mariadb-server  -y   #安装数据库
systemctl restart mariadb.service   #启动数据库软件程序
mysql_secure_installation          #初始化数据库获取用户名和密码[root@localhost ~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.Enter current password for root (enter for none): <–-初次运行直接回车
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.Set root password? [Y/n]    //是否设置root用户密码,输入Y并回车或直接回车New password:               //设置root用户的密码Re-enter new password:      //再次输入你设置的密码
Password updated successfully!
Reloading privilege tables..
… Success!By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n]   //是否删除匿名用户,生产环境建议删除,所以直接回车
… Success!Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] //是否禁止root远程登录,根据自己的需求选择Y/n并//回车,建议禁止
… Success!By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] //是否删除test数据库,直接回车
- Dropping test database…
… Success!
- Removing privileges on test database…
… Success!Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] //是否重新加载权限表,直接回车
… Success!
Cleaning up…
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!mysql -uroot -predhat     #通过初始化的账号密码登录数据(注意p与u后面不能有空格)

修改php配置
systemctl enable nginx mariadb  --now   #将服务启动并设置为开机自启动
cd  /usr/share/nginx/html/wordpress/      #转路径
cp wp-config-sample.php   wp-config.php
vim wp-config.php         #修该php配置文件如图 

注意:DB_NAME后面就是你的数据库名,如果你数据库没改名就是默认MySQL

测试截图

邮箱过于简单杯判定为例子,可以将后缀改为qq.com,或者填写自己真实邮箱


http://www.mrgr.cn/news/60668.html

相关文章:

  • 智慧停车场导航系统架构及反向寻车系统解决方案
  • Excell 中几种自定义公式
  • PyTorch nn.Conv2d 空洞卷积
  • MarkDown代码
  • 查找与排序-插入排序
  • Linux LVS详解
  • leetcode-63-不同陆路径II
  • 超子物联网HAL库笔记:[汇总]
  • 开发维护初学者指南——软件维护
  • 小米大模型岗离职了,聊一下现在的面试....
  • Python 基础语法 - 关系运算符
  • [JAVAEE] 面试题(一) - 锁策略, synchronized的详细介绍
  • 【HTML】之基本标签的使用详解
  • GitHub每日最火火火项目(10.28)
  • Linux内核-sys虚拟文件系统
  • TypeScript -枚举知识点详解
  • labelimg使用教程
  • Springboot整合spring-boot-starter-data-elasticsearch
  • C++入门基础知识129—【关于C 库函数 - time()】
  • 论可以对抗ai编程的软件开发平台(直接把软件需求描述变成软件的抗ai开发平台)的设计
  • Java:String类(超详解!)
  • Vue3与pywebview前后端初步通信
  • java保留两位小数
  • 10月28日,每日信息差
  • Python xlrd库介绍
  • stm32入门教程--DMA