安装Apache服务器之前的配置在DNS服务器配置实例里。
1.安装、启动与停止Apache服务
启动或重新启动、停止Apache服务的命令如下:
使用防火墙命令,放行http服务
更改当前的SELinux值,后面可以跟Enforcing、Permissive或者1、0。
[root@centos ~]# setenforce 0
[root@centos ~]# getenforce
Permissive
测试httpd服务是否安装成功,会跳出火狐浏览器
[root@centos ~]# systemctl start httpd
[root@centos ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@centos ~]# firefox http://127.0.0.1
当前网站普遍的首页面名称是index.html,因此可以向/var/www/html目录中写入一个文件,替换掉httpd服务程序的默认首页面,该操作会立即生效(在本机上测试)。
[root@centos ~]# echo "Welcome To MyWeb" > /var/www/html/index.html
[root@centos ~]# firefox http://127.0.0.1
在客户端上测试