zoukankan      html  css  js  c++  java
  • LHEL6 配置apache基于域名的虚拟主机

        apache有两种虚拟主机,一种是基于ip的,一直是基于域名的。

        基于域名的虚拟主机允许多个域名共用一个ip地址。

        今天在配置虚拟主机的时候遇见如下问题,http.conf配置的都正确,内容如下:

      

       将NameVirtualHost *:80 的注释去掉。
     <VirtualHost *:80>
        ServerAdmin root@localhost
        DocumentRoot /www/virtual
        ServerName station.domain40.example.com
    </VirtualHost>
    <VirtualHost *:80>
        ServerAdmin root@localhost
        DocumentRoot /www/virtual1
        ServerName www.domain40.example.com
    </VirtualHost>
     
    感觉配置的没有问题,后来好长时间发现是selinux的关系,查看apache的selinux配置文件
    man httpd_selinux
     
    设置 /www/virtual的selinux上下文
    执行命令:
    chcon -R -t http_sys_content_t /www/virtual/index.html
    查看/www/virtual/index.html的上下文
    ls -Z /www/virtual/index.html
    即可。。
     
     
     
  • 相关阅读:
    【转】运行维护管理制度
    系统负载超预警 问题定位
    19-多进程学习
    3-Pandas层次化索引&拼接
    2-Anaconda简介&Numpy基础
    1-IPython&jupyter notebook
    18-进程&协程
    17-多线程
    16-网络通信
    15-正则表达式
  • 原文地址:https://www.cnblogs.com/fantiantian/p/3025354.html
Copyright © 2011-2022 走看看