无法在端口 8080(禁止)访问服务器 Centos 6.5 Apache 2.2.15

Can not access to Server at Port 8080(Forbidden) Centos 6.5 Apache 2.2.15

我有一台实验室服务器,并在 /home/info02/

为学生创建了 27 个帐户

"info02"为组名,示例中info9042为账号

我是 info9042,我在“/home/info02/info9042/public_html/index.html”中写了一个简单的 html 文档,但是当我输入 URL 在 chrome(Window 10) 中,我收到以下消息。 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>

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

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

我不知道,我希望这能为您指明正确的方向。如果您打算将其用作 webserver/webpage,我肯定会首先将这些文件放入 /var/www/html 文件夹,将主文件夹用于这样的应用程序。更改配置文件以指向该目录。如果您需要授予学生访问 modify/execute 文件的权限,则需要为他们的用户组分配权限以使用 /var/ww/html 文件夹中的文件。