미채택 완료

localhost로 접속하면 접근이 거부됨! 오류

httpd.conf 에서 다른 프로젝트로 경로를 수정했는데

주소창에 localhost를 입력하면 이런 창이 뜹니다

왜 그런건가요..?ㅠㅠ

3529142417_1663721142.5428.png

|

답변 3개 / 댓글 7개

2022-09-21 (수) 14:27:57

httpd.conf 에서 다른 프로젝트로 경로를 수정했는데

==>

어떤 파일이 어느 부분을 어떻게 수정했는지 내용이 있으면 더 좋을 듯합니다.

답변에 대한 댓글 3개

제가 질문을 드리면서 설명이 미숙했습니다.

httpd.conf 에서 DocumentRoot와 Directory 경로만 수정했습니다.

기존 경로가
DocumentRoot "C:\xampp\htdocs\project1\www"
<Directory "C:\xampp\htdocs\project1\www">
로 되었을 땐 localhost로 잘 들어가졌는데

DocumentRoot "C:\xampp\htdocs\gnoboard\www"
<Directory "C:\xampp\htdocs\project2\www">
로 바꾸니 localhost로 접속하면 접근이 거부 됩니다.

project1과 gnoboard는 다른 프로젝트 파일입니다.
project1는 로컬환경에서 잘 접속이 되었지만,
gnoboard 프로젝트를 로컬환경에서 잠시 확인하려고 경로를 바꿨는데 저런 창이 떴습니다.
제가볼땐 일단 Apache VirtualHost 사용법을 숙지하신뒤 별도로 파일을 분리하시는게 나을것같습니다.
설정 파일(http.conf 등) 모두 봐야 할지 모르겠네요.
project1
으로 문자열 검색을 하셔서
DocumentRoot
<Directory
이것 외에 다른 설정이 더 있는지 살펴 보세요.
2022-09-21 (수) 09:54:21

아파치 설정내에 디렉토리 권한부여가 안되어있을 가능성이 높아보이네요..

<Directory "폴더위치">

         Required all granted

</Directory>

를 httpd.conf 내에 추가 작성하신다음 서비스 재시작후 다시 접속해보시는걸 권장드립니다.


그리고 보통은 /var/log/httpd/error.log /var/log/httpd/access.log 두개의 화일을 확인해보시면
대부분의 오류는 확인가능합니다.

답변에 대한 댓글 3개

참고로 저 Directory 구문은 가장 마지막줄에 추가하시는게 나중에 찾긴 편합니다.
답변 감사합니다. 답변을 참고하여
httpd.config 파일을 보면

DocumentRoot "C:\xampp\htdocs\ooo\www"
<Directory "C:\xampp\htdocs\ooo\www">
#
# 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.4/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks Includes ExecCGI

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride All

#
# Controls who can get stuff from this server.
#
Require all granted

</Directory>
이렇게 되어있습니다.


access.log 는
::1 - - [21/Sep/2022:11:00:34 +0900] "GET / HTTP/1.1" 403 1119
::1 - - [21/Sep/2022:11:00:34 +0900] "GET /favicon.ico HTTP/1.1" 403 1111


error.log는
[Wed Sep 21 11:00:38.722157 2022] [mpm_winnt:notice] [pid 31476:tid 636] AH00422: Parent: Received shutdown signal -- Shutting down the server.
[Wed Sep 21 11:01:08.732154 2022] [mpm_winnt:notice] [pid 31476:tid 636] AH00431: Parent: Forcing termination of child process 30764

이렇게 되어있습니다
Require all granted로 되어있는데 왜 403 에러가 뜨는지 모르겠습니다ㅠㅠ
프로젝트 Directory 경로를 바꾸면 또 수정할 게 있는 걸까요..?ㅠㅠ
에러 로그는 다른 부분을 가져 오신 듯합니다.

http://localhost 도 안되나요?

답변에 대한 댓글 1개

넵 http://localhost 엔터 치면 다시 저 url로 바껴 접근이 거부됨! 창이 뜹니다 ㅠㅠ

답변을 작성하려면 로그인이 필요합니다.