• HTTP虚拟主机


    Ps:http-2.4版本

    [root@localhost ~]# tar zxvf httpd-2.4.23.tar.gz -C /usr/src/

    [root@localhost ~]# cd /usr/src/httpd-2.4.23/
    [root@localhost httpd-2.4.23]# ./configure --prefix=/usr/local/http --enable-so --with-rewrite

    [root@localhost ~]# wget http://mirrors.hust.edu.cn/apache//apr/apr-1.6.3.tar.gz

    [root@localhost ~]# tar zxvf apr-1.6.3.tar.gz

    [root@localhost ~]# cd apr-1.6.3
    [root@localhost apr-1.6.3]# ./configure --prefix=/usr/local/apr

    [root@localhost apr-1.6.3]# make && make install

    [root@localhost ~]# wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.6.1.tar.gz

    [root@localhost ~]# tar zxvf apr-util-1.6.1.tar.gz 

    [root@localhost ~]# cd apr-util-1.6.1

    [root@localhost httpd-2.4.23]# ./configure --prefix=/usr/local/http --enable-so --with-rewrite --with-included-apr

    [root@localhost apr-util-1.6.1]# make && make install

    【问题汇总】

    错误1: 提示错误,这个时候,我们yum安装的rpr软件包似乎不支持,因此需要编译安装

    configure: error: APR not found. Please read the documentation.

    错误2:configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.

    [root@localhost ~]# cp -r apr-1.6.3 /usr/src/httpd-2.4.23/srclib/apr
    [root@localhost ~]# cp -r apr-util-1.6.1 /usr/src/httpd-2.4.23/srclib/apr-util

    # yum install -y apr apr-util apr-devel apr-util-devel 

    # ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite

    #make

    # make install 

    PS:关于apache所以来的apr软件包,所谓的apr也及时可移植运行库,主要就是为实现上层应用提供一个可以跨操作系统底层的应用接口库

    apr接口库是服务之间的调用的接口(api程序接口),比如说,php,tomcat,nginx

    pcre是一个perl库,Pcre出解决C语言中使用正则表达式的问题,在应用web服务时,是为了解决支持HTTP Rewrite模块

    基于同一个IP和端口不同域名的方式在企业中应用广泛

    开启虚拟主机

    
    

    <VirtualHost *:80>
    DocumentRoot "/usr/local/httpd/htdocs/webapp1"
    ServerName www.bxt01.net
    <Directory "/usr/local/httpd/htdocs/webapp1">
    Options All  
    AllowOverride None
    Order allow,deny                 #先允许后拒绝规则
    Allow from all                    #允许所有网段访问
    Deny from 192.168.2.129            #只拒绝2.129访问请求
    </Directory>
    ErrorLog "/var/log/http/webapp1/error_log"
    CustomLog "/var/log/http/webapp1/access_log" common
    </VirtualHost>

    DocumentRoot "/usr/local/httpd/htdocs/webapp2"
    ServerName www.bxy02.net
    <Directory "/usr/local/httpd/htdocs/webapp2">
    Options All
    AllowOverride None
    Order deny,allow     #访问控制规则,先拒绝后允许
    Deny from all        #拒绝所有访问请求
    Allow from 192.168.2.129     #只允许该IP请求访问2.129,同时可允许某个网段访问,如允许192.168.2.0网段访问,只需“Allow from 192.168.2.0/24”即可
    </Directory> ErrorLog "/var/log/http/webapp2/error_log" CustomLog "/var/log/http/webapp2/access_log" common </VirtualHost>

     

    Ps:关于访问控制,针对网段限制,是无法对本地windows客户端有效的,比如说,你允许192.168.2.0网段访问,其他的都拒绝,其中本地windows客户端(192.168.50网段)按理说是不可以访问的,但是也可以访问

  • 相关阅读:
    (原).NET程序加入多语言包解决方案工具,超级棒
    c++标准库中的四个智能指针比较
    Mongodb c++ API的测试和封装
    MongoDB的c++驱动安装痛苦历程
    GLC_Player DOWNLOAD
    MongoDB的连接、创库、删库、插入文档、更新文档
    非关系型数据库--MongoDB的安装及概念
    虚拟机的安装
    OpenGL ES 学习
    QT学习
  • 原文地址:https://www.cnblogs.com/bixiaoyu/p/9424622.html
Copyright © 2020-2023  润新知