Embedded Linux

Ubuntu Linux 에서 Apache 설정 파일들

작성자 임베디드코리아 작성일15-11-23 09:53 조회9,329회 댓글0건
< 아파치 설정하기>

1. 설정 파일 위치에 접근하기
    # cd /etc/apache2

[ 폴더에 접근하면 다양한 설정파일들이 존재함. }
일반적으로 httpd.conf 가 아파치 설정 파일이며, 우분투에서는 세부적으로 분류하여 관리한다..
 -enabled 와 -available 가 있으며, enabled 만 수정 한다.
  ** 세분화 되어 있는 파일들은 다음과 같다.
      -. 아파치 기본 설정    : sudo vi /etc/apache2/apache2.conf
      -. 포트 설정              :  /etc/apache2/ports.conf
      -.  public 파일 설정    :  /etc/apache2/mods-enabled/dir.conf
      -. 언어셋관련 설정      :  /etc/apache2/mods-enabled/autoindex.conf
      -. 파일타입 설정        :  /etc/apache2/mods-enabled/mime.conf
      -. 웹서비스 설정        :    /etc/apache2/sites-enabled/000-default

<  홈 페이지 디렉토리 변경하기  >
 1.  변경할 디렉토리를 만들어준다
      # mkdir  -p  /opt/wep/html

2.  apache2.conf를 수정한다.
    # vi /etc/apache2/apache2.conf
      <Directory /opt/wep/html>
            Options Indexes FollowSymLinks
            AllowOverride None
            Require all granted
        </Directory>
    /var/www/html  이 부분을 원하는 경로로 수정한다.

2. 000-default.conf 를 수정한다.
  # vi /etc/apache2/sites-available/000-default.conf
      ServerAdmin에 관리자 이메일을 쓰고, DocumentRoot에 apache2.conf에서 수정한 경로를 쓴다.
      도메인을 연결해야 하니 다음을 추가한다.

      ServerName 도메인주소
      ServerAlias 도메인주소
      ServerAdmin 이메일주소
      DocumentRoot  /opt/wep/html

3. 디렉토리 소유자와 소유그룹 변경 한다.
  #  chown -R www-data:www-data /opt/wep/html

4. 디렉토리 권한 변경 한다.
    # usermod -a -G www-data 사용자이름
    # chmod -R 775 /home/사용자이름/apm/www

5. 서버 재시작 한다.
    #  service apache2 restart

 ## 기본적으로 아파치는 index.html 파일을 불러오는 것으로 설정이 되어있다.
      index.php 파일을 처음으로 읽기 위해 dir.conf 파일을 아래와 같이 수정해주자. ####
 
  # vi /etc/apache2/mods-enabled/dir.conf
      ---------------------------------------------------------------------------------------------------------------
        <IfModule mod_dir.c>
              DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
      </IfModule>
      # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
      -------------------------------------------------------------------------------------------------------------------