카테고리 없음

apache2 사용법

개발자_이훈규 2020. 3. 12. 08:58

 

 

apache2 사용법

Server version: Apache/2.4.29 (Ubuntu)

 

목적

1개의 서버에서 여러개의 도메인으로 서버를 운용하고 싶다.

 

사용법

경로 : /etc/apache2/sites-available

 

proxy 모듈 키기

apache1은 conf에서 주석을 풀던데 apache2는 a2enmod로 mods-abailable에 soft link을 만든다.

$ sudo a2enmod proxy
$ sudo a2enmod proxy_http

 

사이트 정의

$ cp 000-default.conf 3minchart.com.conf
$ vi 3minchart.com.conf
<VirtualHost *:80>
    ProxyPreserveHost On

    ServerName 3minchart.com
    ServerAlias www.3minchart.com

    Redirect / https://www.youtube.com/channel/UCzkBJeftlZSuyTcc2MNZLuA/
</VirtualHost>

<VirtualHost *:80>
    ProxyPreserveHost On

    ServerName corona.3minchart.com
    ServerAlias www.corona.3minchart.com

    ProxyPass / http://127.0.0.1:3000/
    ProxyPassReverse / http://127.0.0.1:3000/
</VirtualHost>

 

사이트 정의 등록

$ a2ensite 3minchart.com.conf
$ systemctl reload apache2

 

사이트 정의 수정

$ vi 3minchart.com.conf
$ systemctl reload apache2

 

 

Reference

How To Use Apache as a Reverse Proxy with mod_proxy on Ubuntu 16.04

apache2 포트별 도메인 포워딩

apache1 참고

Apache Reverse Proxy 설정(아파치와 노드 연동)