IT Share you

다른 루트 디렉토리에 대해 xampp 웹 서버를 구성하는 방법

shareyou 2020. 12. 10. 21:30
반응형

다른 루트 디렉토리에 대해 xampp 웹 서버를 구성하는 방법


웹 디렉토리는 애플리케이션의 모든 공개 및 정적 파일의 홈입니다. 이미지, 스타일 시트 및 JavaScript 파일을 포함합니다. 또한 프론트 컨트롤러가 사는 곳이기도합니다.

그래서 질문은 내가 xampp를 설치하고 설정할 때 내 웹 디렉토리는 다음과 같습니다.

xampp\htdocs

다음을 설정하고 싶습니다.

xampp\htdocs\myproject\web

어떻게하나요? : 지금은 내 브라우저에 주소를 입력 할 때 http://localhost/
내가 입력 한 xampp\htdocs디렉토리를
내가 내 브라우저에 주소를 입력합니다 : http://localhost/
입력합니다 xampp\htdocs\myproject\web디렉토리를


(xampp 제어판에서) 클릭하여 Apaches httpd.conf를 변경 apache/conf/httpd.conf하고 항목 DocumentRoot및 해당 항목을 조정할 수 Directory있습니다. 그냥 Ctrl+ F"htdocs에"에 대한 당신의 새로운 경로 항목을 변경합니다.


  • C : \ xampp \ apache \ conf \ httpd.conf로 이동합니다.
  • httpd.conf 열기
  • 태그 찾기 : DocumentRoot "C : / xampp / htdocs"
  • 태그 편집 : DocumentRoot "C : / xampp / htdocs / myproject / web"
  • 이제 태그를 찾아 <Directory "C : / xampp / htdocs / myproject / web">로 변경합니다.

  • Apache를 다시 시작하십시오.


특히 Linux (예 : Ubuntu)에서 더 간단한 솔루션을 선호하는 경우 매우 쉬운 방법은 htdocs 폴더에서 의도 한 폴더에 대한 심볼릭 링크를 만드는 것입니다. 예를 들어, "/ home / some / projects / testserver /"라는 폴더에서 파일을 제공하고 싶고 내 htdocs가 "/ opt / lampp / htdocs /"에있는 경우입니다. 다음과 같이 심볼릭 링크를 만드십시오.

ln -s /home/some/projects/testserver /opt/lampp/htdocs/testserver

심볼릭 링크에 대한 명령은 다음과 같이 작동합니다. ln -s target source여기서,

target - The existing file/directory you would like to link TO.
source - The file/folder to be created, copying the contents of the target. The LINK itself.

자세한 도움말은 ln --help Source : Create Symbolic Links in Ubuntu를 참조하십시오.

그리고 끝났습니다. http : // localhost / testserver /를 방문 하십시오. 사실 서버를 다시 시작할 필요조차 없습니다.


Apache 구성 파일 (httpd.conf)을 편집하지 않고 htdocs 폴더를 C : \ xampp \ htdocs에서 D : \ htdocs로 옮겼습니다.

1 단계) C:\xampp\htdocs폴더를 D:\htdocs2 단계로 이동 ) mklink 명령을 사용하여 D : \ htdocs에 연결된 C : \ xampp \ htdocs에 심볼릭 링크를 만듭니다.

D:\>mklink /J C:\xampp\htdocs D:\htdocs
Junction created for C:\xampp\htdocs <<===>> D:\htdocs

D:\>

3 단계) 완료!


여러분, 얼마나 쉬운 일인지 믿지 않으실 것입니다. 그래서 YouTube에 동영상을 올려서 [ 여기를 클릭하세요 ]

지금, 단계 :

  1. xampp 제어판 실행
  2. config라는 버튼을 클릭하십시오.
  3. 아파치 선택 (httpd.conf)
  4. 문서 루트 찾기
  5. 바꾸다

DocumentRoot "C:/xampp/htdocs" <Directory "C:/xampp/htdocs">

그 2 줄 || C : / xampp / htdocs == 루트의 현재 위치 || 원하는 위치로 C : / xampp / htdocs 변경

  1. 저장 완료 : 아파치를 시작하고 로컬 호스트로 이동합니다. 실제보기 [ 비디오보기 여기를 클릭하십시오 ]

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

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

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

위의 코드를 다음 태그 안에 작성하십시오. <Directory "c : \ projects"> </ Directory> c :( 디렉토리 d : e :)는 프로젝트 폴더를 생성 한 드라이브입니다.

별칭 / projects "c : \ projects"

이제 브라우저에서 pr0jects 디렉토리에 액세스 할 수 있습니다.

localhost / projects /


XAMP 제어판을 여는 동안 포트를 변경할 수 있습니다. 다음 단계를 따르십시오.

  1. 시작 버튼에 config net을 클릭하고
  2. 을 선택 httpd.conf하면 텍스트 파일이 열립니다.
  3. 파일과 파일을 확인하십시오 listen:80.
  4. 한 번 listen:80교체 listen:8080하고
  5. 같은 폴더에 저장하십시오.

완료되면 로컬 서버를 시작할 수 있습니다.

참고URL : https://stackoverflow.com/questions/18902887/how-to-configuring-a-xampp-web-server-for-different-root-directory

반응형