你的位置:首页 > 信息动态 > 新闻中心
信息动态
联系我们

安装Apache+mysql+PHP服务器

2022/1/1 15:38:17

准备工作

yum -y install epel-release
yum install dnf -y
dnf update -y

安装Apache

dnf install httpd.x86_64 -y
systemctl enable --now httpd
systemctl status httpd
firewall-cmd --list-all
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
服务名称:httpd
主配置文件:/etc/httpd/conf/httpd.conf
子配置文件:/etc/httpd/conf.d/*.conf
默认发布目录:/var/www/html
默认端口:80 (http) ,443(https)
日志文件:/etc/httpd/logs
开启apche服务后,输入ip查看默认发布页面:

在这里插入图片描述
查看端口

netstat -antlupe |grep httpd

编辑配置文件,修改端口(可选): /etc/httpd/conf/httpd.conf

在这里插入图片描述

vi /etc/httpd/conf/httpd.conf
systemctl restart httpd
firewall-cmd --permanent --add-port=888/tcp

访问控制ip白名单

编辑配置文件:vim /etc/httpd/conf/httpd.conf

在这里插入图片描述

访问控制ip黑名单

编辑配置文件:vim /etc/httpd/conf/httpd.conf

在这里插入图片描述

访问用户认证

生成认证文件,建立admin用户:htpasswd -cm /etc/httpd/htpasswdfile linux

在这里插入图片描述
只允许部分用户可以通过认证,编辑配置文件:vim /etc/httpd/conf/httpd.conf

在这里插入图片描述
在这里插入图片描述
允许所有用户通过认证访问共享目录
在这里插入图片描述

安装PHP

yum install -y php
yum install -y php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
systemctl restart httpd.service
php -v
vi /etc/httpd/conf/httpd.conf
:800
新增 AddType application/x-httpd-php .php .php3 .phtml .inc
新增 AddType application/x-httpd-php-source .phps
service httpd restart

安装mysql

linux下安装mysql实现远程连接
linux下卸载mysql

安装ECShop

浏览http://本机IP/ecshop

ECShop提示不支持JPEG类型

ECShop不可写

新建数据库

CREATE DATABASE test;