2017-04-14 86 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文件夾中的文件。

相關問題