1、Apache服务器的安装、启动与停止rpm –qa | grep httpd(查看是否安装)yum –y install httpd(瀚柏围歪安装)常见操作:systemctl start httpd.service(启动)systemctl status httpd.service(查看状态)service httpd stop(停止)
2、修改防火墙允许http访问firewall-cmd --permanent --zone=public --add-service=httpfirewall-cmd –reloadsetenforce 0 (关闭SE Linux)将Apache服务添加到 开机自启中,如下图:
3、然后在浏览器输入http://+linuxIp,出现页面:
4、配置用户个人主页vim /etc/httpd/conf.d/userdir.conf将UserDir disabled 前面加#注释掉,默认为不可用这样UserDir disable功能关闭。将UserDir public_html 前面的#去掉,默认功能为关闭的去掉后就可以应用了。
5、systemctl restart httpd.service(重启)建立个人主页的根目录/home/luojie/public_inde旌忭檀挢x和index.html,cd /home/luojiemkdir public_htmlvi /public_html/index.html输入:
6、由于CentOS默认的用户主目录权限是drwx------,这个权限将无法让apache的程序浏览,所以至少让你的用户目录权限成为drwx--x--x才行。chmod 755 luojie在浏览器中访问结果: