sudo apt-get update
sudo apt-get install apache2 python-letsencrypt-apache
아파치 설치
sudo vi /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
ServerName test_server1
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /deeplink http://localhost:8080 // 방법1
ProxyPassReverse /deeplink http://localhost:8080
<Location /user> //방법2
ProxyPass http://localhost:8080
ProxyPassReverse http://localhost:8080
</Location>
</VirtualHost>
sudo vi /etc/apache2/sites-available/000-default-le-ssl.conf
<VirtualHost *:443>
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off
ProxyPreserveHost off
ProxyPass /deeplink https://localhost:8080 // 방법1
ProxyPassReverse /deeplink https://localhost:8080
<Location /user> //방법2
ProxyPass https://localhost:8080
ProxyPassReverse https://localhost:8080
</Location>
</VirtualHost>
http/https 프록시 설정파일생성 주의해야할점은 어플리케이션 서버설정에 따라 ProxyPass주소마지막에 /
를 붙인다.
https://stackoverflow.com/questions/48987371/express-app-cant-get-static-content-when-changing-nginx-location-block#answer-48990176
sudo vi script.sh
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_balancer
a2enmod lbmethod_byrequests
a2enmod proxy_connect
service apache2 restart
sudo chmod +x script.sh
sudo ./script.sh
필요한 모드를 설정하는 스크립트 파일을 생성한후 실행한다.
systemctl status apache2.service
or journalctl -xe
위의 명령어로 아파치 서버가 정상적으로 실행되었는지 확인한다.
<host url>/deeplink
주소로 접속해본다.
https://playon.tistory.com/87
https://gridscale.io/en/community/tutorials/apache-server-reverse-proxy-ubuntu/
https://httpd.apache.org/docs/2.4/howto/reverse_proxy.html