apache 설치
=======설치 과정========
최신버전
sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
설치 => sudo apt install apache2 \
libapache2-mod-fcgid libapache2-mod-proxy-uwsgi \
libapache2-mod-xforward openssl
sudo apt purge apache2* => 삭제
sudo apache2 -v => 버전확인
netstat -ntlp => 구동확인
sudo systemctl start apache2 => 시작
sudo systemctl restart apache2 => 재시작
sudo systemctl stop apache2 => 정지
sudo systemctl reload apache2 => 리로드
sudo systemctl enable apache2 => 활성화
sudo systemctl disable apache2 => 비활성화
=======가상호스트========
sudo mkdir -p /home/example.com/html => 폴더생성
sudo chown -R www-data: /var/www/example.com => 사용 권한
cd /etc/apache2/sites-available/ => 폴더이동
cp 000-default.conf example.com.conf => 복사
vi 000-{호스트명}.conf => 호스트 설정
<VirtualHost *:80>
NameVirtualHost 192.168.1.1
ServerName example.com
ServerAlias http://www.example.com
ServerAdmin webmaster@example.com
DocumentRoot /var/www/example.com/public_html
<Directory /var/www/example.com/public_html>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/example.com-error.log
CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined
</VirtualHost>
자동 심볼릭 링크
sudo a2ensite example.com
수동 심볼릭 링크
sudo ln -s /etc/apache2/sites-available/example.com.conf /etc/apache2/sites-enabled/