日期:2014-05-16 浏览次数:20841 次
因为实验室的迫害,我们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.
    #
&nb