
특정 하위 경로를 포트 19011에서 실행되는 백엔드 애플리케이션으로 리디렉션하고 싶습니다. 내 구성 파일( /etc/apache2/sites-available/my_domain.conf
)은 다음과 같습니다.
<VirtualHost *:80>
ServerName my_domain
DocumentRoot /var/www/my_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPass /my_subpath/ http://localhost:19011/
ProxyPassReverse /my_subpath/ http://localhost:19011/
</VirtualHost>
<VirtualHost *:443>
SSLEngine On
SSLProxyEngine On
SSLCertificateFile /etc/letsencrypt/live/my_domain/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my_domain/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
ServerName my_domain
DocumentRoot /var/www/my_domain
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPass /my_subpath/ http://localhost:19011/
ProxyPassReverse /my_subpath/ http://localhost:19011/
</VirtualHost>
이 구성은 HTTP에서는 작동하지만 HTTPS에서는 작동하지 않습니다.
http://my_domain/my_subpath
의도한 대로 백엔드 앱으로 이동하는 반면https://my_domain/my_subpath
404를 반환합니다.
나는 아파치 멍청한 놈인데 왜 이것이 작동하지 않는지 모르겠습니다. 또한 Apache 로그에 오류가 표시되지 않습니다. conf 파일에서 무엇이 빠졌나요?
버전:
- 아파치: 2.4.29
- 운영체제: 우분투 18.04.5
답변1
내 conf 파일에는 아무런 문제가 없다는 것이 밝혀졌습니다. Letsencrypt로 SSL 인증서를 생성한 후 자동으로 생성된 또 다른 conf 파일이 my_domain-le-ssl.conf
아래에 있었습니다 . /etc/apache2/sites-available
해당 conf 파일에는 포트 443에 대한 가상 호스트도 포함되어 있으며 Apache는 해당 호스트를 사용하여 SSL 요청을 처리했습니다.
의심스러운 경우 실행하여 sudo apachectl -S
활성 가상 호스트 구성을 확인하세요. 내 경우에는 다음과 같은 결과가 반환되었습니다.
*:80 my_domain (/etc/apache2/sites-enabled/my_domain.conf:1)
*:443 my_domain (/etc/apache2/sites-enabled/my_domain-le-ssl.conf:2)
*:443 my_domain (/etc/apache2/sites-enabled/my_domain.conf:10)