RHCE的搭建网站

第一步、添加IP地址

[root@localhost ~]# nmcli connection modify ens160 +ipv4.addresses 192.168.228.130/24
[root@localhost ~]# nmcli connerction up ens160
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)

第二步、创建目录以及网页的内容

[root@localhost ~]# mkdir -pv /www/qp
mkdir: created directory '/www'
mkdir: created directory '/www/qp'
[root@localhost ~]# tree /www/
/www/
└── qp

1 directory, 0 files
[root@localhost ~]# echo "my name is qp" > /www/qp/index.html
[root@localhost ~]# cat /www/qp/index.html
my name is qp

第三步、配置文件的输写

[root@localhost ~]# cd /etc/httpd/conf.d/
[root@localhost conf.d]# vim ip10.conf
# 在里面配置文件
<virtualhost 192.168.228.10>
        servername 192.168.228.10
        documentroot /www/qp
</virtualhost>
<directory /www/qp>
        allowoverride none
        require all granted
</directory>

第四步、重启服务

[root@localhost conf.d]systemctl restart httpd
Enter TLS private key passphrase for www.ceshi.com:443 (RSA):******* 

第五步、关闭防火墙和selinux

# 首先关闭防火墙
[root@localhost conf.d]# systemctl stop firewalld
[root@localhost conf.d]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2022-11-16 23:32:49 CST; 12s ago
     Docs: man:firewalld(1)
  Process: 1083 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, stat>
 Main PID: 1083 (code=exited, status=0/SUCCESS)

Nov 16 22:52:29 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Nov 16 22:52:30 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Nov 16 22:52:31 localhost.localdomain firewalld[1083]: WARNING: AllowZoneDrifting is enabled. Thi>
Nov 16 23:32:49 localhost.localdomain systemd[1]: Stopping firewalld - dynamic firewall daemon...
Nov 16 23:32:49 localhost.localdomain systemd[1]: firewalld.service: Succeeded.
Nov 16 23:32:49 localhost.localdomain systemd[1]: Stopped firewalld - dynamic firewall daemon.
# 其次关闭selinux
[root@localhost conf.d]# getenforce
Enforcing
[root@localhost conf.d]# setenforce 0
[root@localhost conf.d]# getenforce
Permissive

第六步、访问的测试

[root@localhost conf.d]# curl 192.168.228.11
my name is qp

猜你喜欢

转载自blog.csdn.net/Zombie_QP/article/details/127895242