Press "Enter" to skip to content

[태그:] 방화벽

Ubuntu 20.04.3 LTS에서 Apache2 웹서버 설치

쉘에서 다음 명령어를 순서대로 실행하세요.

/var/www/html$ sudo apt update

/var/www/html$ sudo apt install apache2

방화벽 설정, 접속이 안될 경우 반드시 설정해야 함.
/var/www/html$ sudo ufw allow 'Apache Full'
Rule added
Rule added (v6)

/var/www/html$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
1194/tcp                   ALLOW       Anywhere
OpenSSH                    ALLOW       Anywhere
Apache Full                ALLOW       Anywhere
1194/tcp (v6)              ALLOW       Anywhere (v6)
OpenSSH (v6)               ALLOW       Anywhere (v6)
Apache Full (v6)           ALLOW       Anywhere (v6)
  • 환경설정 디렉토리 : /etc/apache2
  • 환경설정 예제파일 : /etc/apache2/apache2.conf입니다.
  • 포트 설정 : /etc/apache2/ports.conf
  • Apache Virtual Hosts 설정 : /etc/apache2/sites-available
    이 파일은 /etc/apache2/sites-enabled 디렉토리에 링크되어 있어야 함
  • 가상 호스트를 활성화 설정 : site-available
    site-enabled 디렉토리로 a2ensite 명령을 사용하여 symlink를 생성해야 함.
    비활성화하려면 a2dissite 명령 사용 함.
  • 도메인 이름이 mydomain.com인 경우 가상 호스트 구성 파일의 이름은 /etc/sshb2/vmx-available/mydomain.com.conf 으로 설정함.
  • Apache 모듈 로드 설정 : /etc/apache2/mods-available/
    mods-available 디렉토리의 구성은 a2enconf 명령을 사용하여 /etc/apache2/mods-enable/ 디렉토리에 대한 symlink를 생성해야 함.
    비활성화 하려면 a2disconf 명령 사용 함.
  • 글로벌 설정파일 : /etc/apache2/conf-available/ 디렉토리에 저장됨.
    conf-available 디렉토리의 파일은 a2enconf 명령을 사용하여 /etc/apache2/conf-enabled/에 대한 symlink를 생성해야 함.
    비활성화 하려면 a2disconf 명령 사용 함.
  • 로그 파일(ex:access.log 및 error.log) : /var/log/apache/ 디렉토리에 저장됨.