tech-tips/Программное обеспечение/Веб-серверы/apache2/Reverse-proxy до docker контейнера.md

49 lines
1.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
tags: ["apache2", "ubuntu", "docker"]
---
```Shell
sudo a2enmod proxy proxy_http proxy_balancer lbmethod_byrequests
sudo nano /etc/apache2/sites-available/myhost.conf
```
```
# example.com заменить на свой адрес
<VirtualHost example.com:80>
ServerName example.com
# обязательно без SSL:
ProxyPreserveHost On
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
# обязательно для SSL:
# RewriteEngine on
# RewriteCond %{SERVER_NAME} =example.com
# RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
# обязательно для SSL:
#<IfModule mod_ssl.c>
#<VirtualHost example.com:443>
# ServerName example.com
# ProxyPreserveHost On
# ProxyPass / http://localhost:8080/
# ProxyPassReverse / http://localhost:8080/
# сертификаты можно получить через certbot
# SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
# SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
# Include /etc/letsencrypt/options-ssl-apache.conf
#</VirtualHost>
#</IfModule>
# Ctrl+O
# Enter
# Ctrl+X
```
```Shell
sudo a2ensite iptv
# для подгрузки включенных модулей выполнить именно restart, а не reload
sudo systemctl restart apache2
```