LinuxProbe 发表于 2020-7-3 12:18:45

RHEL 8 搭建 Apache Web 服务


RHEL 8 搭建 Apache Web 服务,搭建前请把 yum 源配好。
环境Red Hat Enterprise Linux release 8.0
VMware Workstation Pro 14搭建步骤
# yum install -y httpd# systemctl start httpd# iptables -F# systemctl stop firewalld# systemctl disable firewalldRemoved /etc/systemd/system/multi-user.target.wants/firewalld.service.Removed /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.# setenforce 0# ifconfigens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>mtu 1500      inet 192.168.10.118netmask 255.255.255.0broadcast 192.168.10.255      inet6 fe80::e09a:769b:83f0:8efaprefixlen 64scopeid 0x20      ether 00:50:56:34:0d:74txqueuelen 1000(Ethernet)      RX packets 1959bytes 1690200 (1.6 MiB)      RX errors 0dropped 0overruns 0frame 0      TX packets 1245bytes 120922 (118.0 KiB)      TX errors 0dropped 0 overruns 0carrier 0collisions 0lo: flags=73<UP,LOOPBACK,RUNNING>mtu 65536      inet 127.0.0.1netmask 255.0.0.0      inet6 ::1prefixlen 128scopeid 0x10      looptxqueuelen 1000(Local Loopback)      RX packets 0bytes 0 (0.0 B)      RX errors 0dropped 0overruns 0frame 0      TX packets 0bytes 0 (0.0 B)      TX errors 0dropped 0 overruns 0carrier 0collisions 0virbr0: flags=4099<UP,BROADCAST,MULTICAST>mtu 1500      inet 192.168.122.1netmask 255.255.255.0broadcast 192.168.122.255      ether 52:54:00:9c:ef:c6txqueuelen 1000(Ethernet)      RX packets 0bytes 0 (0.0 B)      RX errors 0dropped 0overruns 0frame 0      TX packets 0bytes 0 (0.0 B)      TX errors 0dropped 0 overruns 0carrier 0collisions 0在浏览器输入 192.168.10.118 查看 Apache Web 服务状态https://www.linuxprobe.com/wp-content/uploads/2020/02/1-20.png自定义首页内容
# echo "HELLO RHEL8" > /var/www/html/index.html# systemctl restart httpdhttps://www.linuxprobe.com/wp-content/uploads/2020/02/2-17.png设置文件共享服务
# rm -rf /etc/httpd/conf.d/welcome.conf # rm -rf /var/www/html/index.html# touch /var/www/html/file{1..10}# systemctl restart httpdhttps://www.linuxprobe.com/wp-content/uploads/2020/02/3-10.png设置端口映射
https://www.linuxprobe.com/wp-content/uploads/2020/02/4-11.png查看宿主机IPhttps://www.linuxprobe.com/wp-content/uploads/2020/02/5-6.png在浏览器输入 192.168.0.7:118 测试文件共享服务状态https://www.linuxprobe.com/wp-content/uploads/2020/02/6-2.png解决中文乱码
# touch /var/www/html/你好红帽8.txt# systemctl restart httpdhttps://www.linuxprobe.com/wp-content/uploads/2020/02/7-4.png解决方法
在 /etc/httpd/conf/httpd.conf 配置文件中加入 IndexOptions Charset=UTF-8# vim /etc/httpd/conf/httpd.conf316 AddDefaultCharset UTF-8317 IndexOptions Charset=UTF-8# systemctl restart httpd https://www.linuxprobe.com/wp-content/uploads/2020/02/8-3.png

页: [1]
查看完整版本: RHEL 8 搭建 Apache Web 服务