Search code examples
htmlapache2.2centos6.5

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


I have a Lab server and made 27 accounts for students at /home/info02/

"info02" is a group name and info9042 is an account in example.

I'm info9042 and i wrote a simple html document in "/home/info02/info9042/public_html/index.html" but when i type URL in chrome(Window 10), I get message below. enter image description here

Here is my "/etc/httpd/conf/httpd.conf" file. What should i change code in conf file?

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

Solution

  • OK, I see several issues here that could be causing your issue(s), moreso than just the httpd config file. So basically your index.html file is a web page (I'm assuming you want to give students access to or someone else). One of the possible problems with what you are doing is, you have the html file (website) located in a folder you made in the /home/ directory. When you created websites, particularly in Apache, they should go under the "/var/www/" directory, because Apache by default sets up security and server settings to use that directory as like a web server directory. So a start to solve your issue would be to move your files/folders under the /var/www folder (or the /var/www/html folder). This can be customized/configured accordingly.

    Another problem you have is that, you have two directory initiatives in your httpd file (you should just have one I believe), and your document root is pointing to /var/www/html. A third problem that could be causing a conflict; typically apache/virtual host is configured to load web pages on port 80, which are you trying to access on port 8080 (localhost). You may nave never specified it to load on localhost, and you may not have the ports open either. Your httpd file (I haven't worked with centos two much) doesn't seem to have the Virtual Host surrounding tags I am familair with, but typically you create a virtual host container that specifies a port to load those web pages over.

    I don't know, I hope that points you in the right direction. I would definitely start by putting those files into the /var/www/html folder if you intend on using this as a webserver/webpage, it's not good practice (not safe) to use the home folder for such applications. Change the config file to point to that directory. If you need to give students access to modify/execute files, you will need to assign their usergroup permissions to work with the files in the /var/ww/html folder.