通过yum方式安装httpd


1.  yum -y install httpd

 

2.  编辑配置文件:
vi /etc/httpd/conf/httpd.conf

修改80主机的根目录为:  /home/repo/yum/centos-release  

同时开启目录浏览:

 

DocumentRoot "/home/repo/yum/centos-release"

<Directory "/home/repo/yum/centos-release">
Options Indexes FollowSymLinks
Order allow,deny
Allow from all
AllowOverride None
Require all granted
IndexOptions Charset=UTF-8
IndexOptions NameWidth=*
</Directory>

 

3. 设置目录权限:

      

vi  /etc/selinux/config   # 关闭selinux, 把  SELINUX=enforcing  修改 SELINUX=disable

setenforce 0      # 使得selinux立即关闭

chown apache:apache /home/repo/yum/centos-release/    # 设置目录权限,避免无法浏览索引

 

4.  启动服务:  
     

      service httpd start
      service firewalld stop # 停止防火墙
      systemctl disable firewalld  # 禁用防火墙
      systemctl enable httpd   # 设置开启自启动

 

    尝试通过 http://ip地址/  访问, 我这里访问  http://192.168.88.118/7/

5. 关于错误调试,记得打开错误日志查看即可:  tailf   /etc/httpd/logs/error_log
    所有相关错误,都可以通过百度找到答案。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM