161
edits
Line 63: | Line 63: | ||
Für BOSH und WebSocket wird ein Web-Server als Proxy verwendet. | Für BOSH und WebSocket wird ein Web-Server als Proxy verwendet. | ||
=== Apache 2 Proxy Setup === | |||
a2enmod rewrite proxy proxy_http # Module für BOSH | a2enmod rewrite proxy proxy_http # Module für BOSH | ||
a2enmod proxy proxy_wstunnel # Module für WebSocket | a2enmod proxy proxy_wstunnel # Module für WebSocket | ||
<VirtualHost *:80> | |||
ServerAdmin webmaster@domain.tld | |||
DocumentRoot /var/www/domain.tld | |||
ServerName www.domain.tld | |||
ServerAlias domain.tld | |||
ServerSignature Off | |||
Header set Access-Control-Allow-Origin "*" | |||
RewriteEngine On | |||
RewriteCond %{HTTPS} !=on | |||
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] | |||
</VirtualHost> | |||
<VirtualHost *:443> | |||
ServerAdmin webmaster@domain.tld | |||
DocumentRoot /var/www/domain.tld | |||
ServerName www.domain.tld | |||
ServerAlias domain.tld | |||
ServerSignature Off | |||
SSLEngine on | |||
SSLCertificateFile "/etc/ssl/certs/ssl-cert-snakeoil.pem" | |||
SSLCertificateKeyFile "/etc/ssl/private/ssl-cert-snakeoil.key" | |||
ErrorLog ${APACHE_LOG_DIR}/error.log | |||
SSLProxyEngine on | |||
<Location /http-bind> | |||
Order allow,deny | |||
Allow from all | |||
</Location> | |||
RewriteEngine On | |||
RewriteRule ^/http-bind$ https://domain.tld:5281/http-bind [P,L] | |||
<IfModule mod_proxy.c> | |||
<IfModule mod_proxy_wstunnel.c> | |||
ProxyTimeout 900 | |||
ProxyPreserveHost On | |||
ProxyPass /xmpp-websocket "wss://domain.tld:5281/ws" | |||
</IfModule> | |||
</IfModule> | |||
</VirtualHost> | |||
<VirtualHost *:443> | |||
ServerAdmin webmaster@domain.tld | |||
DocumentRoot /var/www/domain.tld | |||
ServerName uploads.domain.tld | |||
ServerSignature Off | |||
SSLEngine on | |||
SSLCertificateFile "/etc/ssl/certs/ssl-cert-snakeoil.pem" | |||
SSLCertificateKeyFile "/etc/ssl/private/ssl-cert-snakeoil.key" | |||
ErrorLog ${APACHE_LOG_DIR}/error.log | |||
SSLProxyEngine on | |||
RewriteEngine On | |||
RewriteRule ^/upload/(.*) https://uploads.domain.tld:5281/upload/$1 [P,L] | |||
</VirtualHost> | |||
=== cfg.lua === | |||
Component "uploads.domain.tld" "http_upload" | |||
http_external_url = "https://uploads.domain.tld" | |||
http_upload_expire_after = 60 * 60 * 7 | |||
* https://prosody.im/doc/websocket | * https://prosody.im/doc/websocket |
edits