LAMP环境
LAMP
LAMP是指一组通常一起使用来运行动态网站或者服务器的自由软件名称首字母缩写:
环境搭建
安装
yum -y install httpd
systemctl start httpd   启动httpd服务
systemctl status httpd  查看httpd服务状态

访问 网址192.168.79.132 访问成功 (原文件 welcome.conf被我删了)

Apache配置文件 httpd_conf
主配置文件位置 /etc/httpd/conf/httpd_conf
日志位置: /var/log/httpd/
网站根目录位置  /var/www/html
实验
首页删除 可以看出 网站的目录暴露出来 为了防止 访问 我们进行设置 并查看日志分析
首先打开 httpd_conf 进行编辑
vi /etc/httpd/conf/httpd_conf
/Options Indexes FollowSymLinks   查找
把Options Indexes FollowSymLinks  修改成
#Options Indexes FollowSymLinks
退出 wq保存即可
systemctl restart httpd   重启一下httpd服务即可


可以看出被禁止访问

同时打开一个新的端口 去查看日志

查看日志access.log 首先清空一下 然后打开
 echo '' > access_log 清空一下日志
 tail -f access_log    打开日志


点击访问192.168.79.132 然后查看日志 出现访问信息 403

安装数据库
安装命令
yum -y install mariadb mariadb-server
安装完成MariaDB,首先启动MariaDB
systemctl start mariadb
设置开机启动
systemctl enable mariadb
MariaDB的相关简单配置
mysql_secure_installation
设置密码
Enter current password for root (enter for none):<#初次运行直接回车
Set root password? [Y/n] <– 是否设置root用户密码,输入y并回车或直接回车
New password: <– 设置root用户的密码
Re-enter new password: <– 再输入一次你设置的密码
其他设置
Remove anonymous users? [Y/n] <– 是否删除匿名用户,回车
Disallow root login remotely? [Y/n] <–是否禁止root远程登录,回车,选n
Remove test database and access to it? [Y/n] <– 是否删除test数据库,回车
Reload privilege tables now? [Y/n] <– 是否重新加载权限表,回车
登录
mysql -uroot -p   #回车后 输入密码
安装php
yum install php php-devel      #安装
systemctl restart httpd.service  #生效
/var/www/html    #下建立一个phpinfo.php文件   <?php phpinfo(); ?>
安装php的扩展
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
 
                    
                
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号