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。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值