리눅스 httpd.conf

IT위키
221.153.37.97 (토론)님의 2018년 5월 2일 (수) 21:41 판 (→‎설정법)

리눅스 아파치 웹서버의 메인 설정파일

  • 위치 : /etc/conf/httpd/httpd.conf

설정법

기본 설정

Listen 1120
ServerName webadmin.example.com:1120
DocumentRoot "/var/www/html/webadmin"
ServerAdmin webadmin@example.com
DirectoryIndex index.php index.html index.htm
  • Listen : 사용할 포트를 지정한다.
  • ServerName : 서버의 도메인을 입력한다.
  • DocumentRoot : 웹 문서가 위치하는 디렉터리를 지정한다.
  • ServerAdmin : 서버 관리자 이메일을 입력한다.
  • DirectoryIndex : 클라이언트가 디렉토리를 요청할때 먼저 읽히는 파일들을 지정한다.

접근 제어

<Directory "/www/ihd/admin">
  Order Deny,Allow
  Deny from All
  Allow from 192.168.2.0/24
</Directory>
  • Order : Deny와 Allow의 순서를 정한다.
    • Allow,Deny 또는 Deny,Allow 둘중에 하나를 적는다.
    • 최종적으로 읽히는 정책이 동작한다.
  • 위 예제의 경우 기본적으로 다 막고, 192.168.2 대역만 오픈한다.