Apache-wed服务器环境的安装
一。安装httpd并且开启httpd
yum install httpd
systemctl start httpd
二。关闭防火墙
systemctl stop firewall
三。常规配置wed服务
mkdir /www
vim index.html(里面写入自己的内容)
chmod 755 index.htm
chmod 755 /www
vim /etc/httpd/conf/httpd.conf (修改httpd.conf默认配置文件)
systemctl restart httpd
测试:浏览器输入自己ip地址
四。通过用户主页配置wed服务
1.创建用户并且修改加用户目录权限
useradd xiaoming
passwd xiaoming
chmod 705 xiaoming
2.创建xiaoming个人首页默认文件
mkdir /home/xiaoming/public
cd /home/xiaoming/public
vim index.html(创建xiaoming的网页)
3.修改用户主页配置文件
vim /etc/httpd/conf.d/userdir.conf
4.重启服务:systemctl restart httpd
拓展:添加DNS域名
1.安装DNS服务
yum install bind bind-chroot -y
2.修改主配置文件
vim /etc/named.conf
vim /etc/named.rfc1912.zones(进入该目录,追加以下内容)
zone "TestWeb.com" IN {
type master;
file "named.TestWeb";
allow-update {none;};
};
zone "0.168.192.in-addr.arpa" IN {
type master;
file "named.192.168.0";
allow-update {none;};
};
3。创建并修改区域配置文件
cd /var/named
cp -a named.localhost name.TestWeb
cp -a named.loopback name.192.168.0
4.修改配置
vim name.TestWeb
5.vim name.192.168.0
6.修改本地DNS指向
vim /etc/resolv.conf
7.重启服务
systemctl restart named