curl -I www.qq.com # 可以查看使用的服务器类型

以上服务器都是提供超文本传输协议的软件。常用的服务器类型:Apache、nginx、stgw、Tengine
dnf install httpd.x86_64 -y
systemctl enable --now httpd ##开启服务并设定服务位开机启动
firewall-cmd --list-all ##查看火墙信息
firewall-cmd --permanent --add-service=http ##在火墙中永久开启http访问
firewall-cmd --permanent --add-service=https ##在火墙中永久开启https访问
firewall-cmd --reload ##刷新火墙使设定生效


httpd/etc/httpd/conf/httpd.conf主配置文件/etc/httpd/conf.d/*.conf 子配置文件/var/www/htmlindex.html80 http443 https(加密的http)apache/etc/httpd/logsvim /etc/httpd/conf/httpd.conf
Listen 8080
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
systemctl restart httpd

vim /etc/httpd/conf/httpd.conf # 在这里面修改发布默认文件
systemctl restart httpd


/etc/httpd/conf/httpd.conf # 在配置文件中修改下面的内容


ip的访问控制/etc/httpd/conf/httpd.conf





htpasswd -cm /etc/httpd/.htpasswd admin # 创建用户认证名单
htpasswd -m /etc/httpd/.htpasswd sxl # 增加认证用户




/etc/httpd/conf.d/Vhost.conf # Vhost.conf是自定义,后缀不变



dnf install httpd-manual -y # 安装Apache使用说明书

dnf install php -y # 安装php插件


chmod +x /var/www/html/cgi/index.cgi # 添加可执行权限
/etc/httpd/conf.d/Vhost.conf



dnf install python3-mod_wsgi # 安装wsgi工具


dnf install mod_ssl -y # 安装加密插件

openssl req --newkey rsa:2048 -nodes -sha256 -keyout /etc/httpd/certs/westos.org.key -x509 -days 365 -out /etc/httpd/certs/westos.org.crt


/etc/httpd/conf.d/ssl.conf # 指定证书位置


/etc/httpd/conf.d/Vhost.conf # 指定访问跳转


squid反向代理
实验环境:
172.25.254.100 ##Apache服务器
172.25.254.200 ##squid,没有数据负责缓存
vim /etc/squid/squid.conf
http_port 80 vhost vport ##vhost 支持虚拟域名 vport 支持虚拟端口
#当172.25.254.30的80端口被访问会从172.25.254.20的80端口缓存数据
cache_peer 172.25.254.20 parent 80 0 proxy-only
systemctl restart squid


测试:
