首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

linux上apache多网站配置

2012-09-07 
linux下apache多网站配置因为实验室的迫害,我们16楼所在的成员得不到足够的主机来做实验,不得以只好在一台

linux下apache多网站配置

因为实验室的迫害,我们16楼所在的成员得不到足够的主机来做实验,不得以只好在一台机子的apache服务器上跑两个网站,记录下配置过程:

配置网卡ipconfig eth1:1 xxx.xx.xx.xx netmask xxx.xxx.xxx.xxx

配置httpd.conf文件

末尾添加:

<VirtualHost 172.22.99.21>
DocumentRoot "/etc/httpd/htdocs1"    
ServerName 172.22.99.21
</VirtualHost>

原网站可以访问,但新配置网站出现网页访问forbidden的错误

最后昌哥发现是<directory>目录问题

在原来的网站配置部分是:

<Directory "/etc/httpd/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks


    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>

里面网站所在目录有一句    Allow from all,从后来事态的发展来看,默认值应该是不允许远程访问,于是仿照着在这段代码下面写另一个网站的配置:

<Directory "/etc/httpd/htdocs1">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks
    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride None
    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all
</Directory>

PS:开始/etc/rc.d/init.d/httpd找不到了,后来弄了个链接来解决:ln /etc/httpd/bin/apachectl /etc/rc.d/init.d/httpd

16楼的网络攻击和20楼相比真是有过之而无不及,现在网速已经是牛车的水平了还不知道到底是哪里的攻击。服了现在的黑客了,impressive。

热点排行