1.准备 yum 挂载
2.安装
yum install httpd* -y
systemctl restart httpd
防火墙:
systemctl stop firewalld
systemctl disable firewalld
selinux设置:
setenforce 0
getenforce
3.测试
firefox http://127.0.0.1
出现Apache页面
默认网站数据位置: /var/www/html
完成!
♥♥♥♥♥♥♥♥♥♥♥♥♥♥♥
进阶:
修改网站根目录和首页文件
1.创建
mkdir /var/www1 //新建www1
echo "Welcome To Myweb" > /var/www1/myweb.html //修改根目录,并且创建首页myweb.html 。
2.修改配置文件
vi /etc/httpd/conf/httpd.conf
大约 119行位置,修改用于定义网站数据保存路径的参数 DocumentRoot 修改为/var/www1
大约 124行位置,权限参数 Directory 后面的路径 也修改为 /var/www1
DocumentRoot "/var/www1"
Directory "/var/www1">
AllowOverride None
# Allow open access:
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html myweb.html
</IfModule>
3.防火墙设置、selinux设置、重启服务
4.测试 打开内置火狐浏览器 127.0.0.1 查看是否出现 Welcome To Myweb
共有 0 条评论