centos7搭建lnmp/lamp(未完待续)

版权声明:a3uRa QQ:962620891 github:asuralinmo.github.io https://blog.csdn.net/qq_41173457/article/details/82951757

下载php,这里用5.x的 太高了的话 例如 7.x 不方便 学习 很多搭建的靶场会报错
执行下面的命令,安装 PHP 已经它的常用的库

yum install php php-mysql php-fpm php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc -y

下载nginx
直接安装 我的出现了 没有可用的软件包 nginx ,需要先下载个epel
yum install epel-release
参考:https://www.bdelay.com/article/264


下载mysql或者是mariadb
这里直接下载的mariadb
sudo yum install mariadb-server
原因,MariaDB是MySQL的一个分支,主要由开源社区进行维护和升级,而MySQL被Oracle收购以后,发展较慢
参考https://blog.csdn.net/FungLeo/article/details/78789932
mysql可能会出现yum install mysql-server没有可用包的问题


关闭防火墙和selinux 否则 在vm虚拟上搭建的 本机访问不到
vim /etc/sysconfig/selinux
将文件中SELINUX=enforcing改为disabled
systemctl stop firewalld.service


修改几个配置文件
配置文件 需要学习一番


几个命令
start为开 stop就为停了 restart就是重启
systemctl start php-fpm 开启php-fpm
systemctl start mariadb 开启 mariadb
systemctl stop firewalld.service 关闭防火墙
systemctl start nginx 开启 nginx
systemctl enable nginx 设为开机启动


测试一下
找到web目录 可能是nginx的默认web目录 我这里是 /usr/share/nginx/html
赋权
sudo chmod -R 777 /usr/share/nginx/html
vim 1.php

<?php phpinfo();?>

ifconfig
访问,192.168.26.138/1.php
出现那个画面 即成功了

猜你喜欢

转载自blog.csdn.net/qq_41173457/article/details/82951757