2017-04-14 87 views
0

我有一个实验室的服务器和由27分占学生/家/ info02/不能在8080端口访问服务器(禁止)的Centos 6.5的Apache 2.2.15

“info02”是一组名称和info9042是一个例子中的帐户。

我是info9042,我在“/home/info02/info9042/public_html/index.html”中写了一个简单的html文档,但是当我在chrome(Window 10)中键入URL时,我在下面得到消息。 enter image description here

这是我的“/etc/httpd/conf/httpd.conf”文件。 我应该更改conf文件中的代码?

# DocumentRoot: The directory out of which you will serve your 
# documents. By default, all requests are taken from this directory, but 
# symbolic links and aliases may be used to point to other locations. 
# 
DocumentRoot "/var/www/html" 
#DocumentRoot "/home/nlp" 
# 
# Each directory to which Apache has access can be configured with respect 
# to which services and features are allowed and/or disabled in that 
# directory (and its subdirectories). 
# 
# First, we configure the "default" to be a very restrictive set of 
# features. 
# 
<Directory /> 
    Options FollowSymLinks 
    AllowOverride None 

</Directory> 

# 
# Note that from this point forward you must specifically allow 
# particular features to be enabled - so if something's not working as 
# you might expect, make sure that you have specifically enabled it 
# below. 
# 

# 
# This should be changed to whatever you set DocumentRoot to. 
# 
<Directory "/var/www/html"> 

# 
# 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> 

# 
# UserDir: The name of the directory that is appended onto a user's home 
# directory if a ~user request is received. 
# 
# The path to the end user account 'public_html' directory must be 
# accessible to the webserver userid. This usually means that ~userid 
# must have permissions of 711, ~userid/public_html must have permissions 
# of 755, and documents contained therein must be world-readable. 
# Otherwise, the client will only receive a "403 Forbidden" message. 
# 
# See also: http://httpd.apache.org/docs/misc/FAQ.html#forbidden 
# 
<IfModule mod_userdir.c> 
    # 
    # UserDir is disabled by default since it can confirm the presence 
    # of a username on the system (depending on home directory 
    # permissions). 
    # 
    #UserDir disabled root 

    # 
    # To enable requests to /~user/ to serve the user's public_html 
    # directory, remove the "UserDir disabled" line above, and uncomment 
    # the following line instead: 
    # 
    UserDir public_html 
</IfModule> 

# 
# Control access to UserDir directories. The following is an example 
# for a site where these directories are restricted to read-only. 
# 
<Directory /home/*/*/public_html> 
    AllowOverride FileInfo AuthConfig Limit 
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec 
    <Limit GET POST OPTIONS> 
     Order allow,deny 
     Allow from all 
    </Limit> 
    <LimitExcept GET POST OPTIONS> 
     Order deny,allow 
     Deny from all 
    </LimitExcept> 
</Directory> 

回答

0

好的,我在这里看到几个问题可能导致您的问题,而不仅仅是httpd配置文件。所以基本上你的index.html文件是一个网页(我假设你想让学生访问或其他人)。您正在做的一个可能的问题是,您的html文件(网站)位于您在/ home /目录中创建的文件夹中。当您创建网站时,特别是在Apache中,他们应该在“/var/www/”目录下,因为默认情况下Apache会设置安全和服务器设置,以便像使用Web服务器目录一样使用该目录。因此,开始解决您的问题是将文件/文件夹移动到/ var/www文件夹(或/ var/www/html文件夹)下。这可以相应地进行定制/配置。

您遇到的另一个问题是,您在httpd文件中有两个目录计划(您应该只有一个我相信),并且您的文档根目录指向/ var/www/html。第三个可能导致冲突的问题;通常apache /虚拟主机被配置为加载80端口上的网页,您尝试访问端口8080(本地主机)。您可能没有指定它在本地主机上加载,也可能没有打开端口。你的httpd文件(我还没有用过centos两个)似乎没有虚拟主机周围的标签,但通常你创建一个虚拟主机容器,指定一个端口来加载这些网页。

我不知道,我希望你指出正确的方向。如果您打算将这些文件用作网络服务器/网页,那么我肯定会将这些文件放入/ var/www/html文件夹,但对这些应用程序使用主文件夹并不是一个好习惯(不安全)。将配置文件更改为指向该目录。如果您需要让学生访问修改/执行文件,则需要指定其用户组权限以处理/ var/ww/html文件夹中的文件。

相关问题