2017-04-14 14 views
0

나는/홈/info02/포트 8080에서 서버에 액세스 할 수 없습니다 (금지)를 CentOS 6.5 아파치 2.2.15

"info02이"그룹 이름 및 info9042에서 학생들을위한 27 개 계정을 실험실 서버를 가지고 만든 예를 들어 계정입니다.

저는 info9042입니다. "/home/info02/info9042/public_html/index.html"에 간단한 html 문서를 작성했지만 크롬 (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 파일은 웹 페이지입니다 (학생에게 다른 사람에게 액세스 권한을 부여하려고한다고 가정합니다). 당신이하는 일과 관련된 가능한 문제 중 하나는/home/디렉토리에서 만든 폴더에 html 파일 (웹 사이트)이 있다는 것입니다. 특히 Apache에서 웹 사이트를 만들 때 Apache는 기본적으로 웹 서버 디렉토리처럼 해당 디렉토리를 사용하도록 보안 및 서버 설정을 설정하기 때문에 "/var/www/"디렉토리 아래에 있어야합니다. 따라서 문제를 해결하려면/var/www 폴더 (또는/var/www/html 폴더) 아래에 파일/폴더를 옮기십시오. 이에 따라 사용자 정의/구성 할 수 있습니다.

또 다른 문제점은 httpd 파일에 디렉토리 이니셔티브가 2 개 있고 (필자가 믿어야 만 함) 문서 루트가/var/www/html을 가리키고 있다는 것입니다. 갈등의 원인이 될 수있는 세 번째 문제; 일반적으로 아파치/가상 호스트는 포트 8080 (로컬 호스트)에서 액세스하려는 포트 80에서 웹 페이지를로드하도록 구성됩니다. localhost에로드하도록 지정하지 않았으므로 포트를 열지 않아도됩니다. 귀하의 httpd 파일 (나는 centos 두 가지로 일한 적이 없다) 나는 familair 오전 태그를 둘러싼 가상 호스트를 가지고있는 것 같지 않지만, 일반적으로 당신은 그 웹 페이지를로드하는 포트를 지정 가상 호스트 컨테이너를 만듭니다.

나는 잘 모르겠다. 올바른 방향으로 가보 길 바란다. 웹 서버/웹 페이지로 사용하려는 경우 해당 파일을/var/www/html 폴더에 저장하는 것으로 시작합니다. 이러한 응용 프로그램에 홈 폴더를 사용하는 것은 안전하지 않습니다. 해당 디렉토리를 가리 키도록 구성 파일을 변경하십시오. 학생에게 파일 수정/실행에 대한 액세스 권한을 부여해야하는 경우/var/ww/html 폴더에있는 파일에 대한 작업에 대한 사용자 그룹 권한을 할당해야합니다.