52 lines
1.6 KiB
Plaintext
52 lines
1.6 KiB
Plaintext
<IfModule mod_ssl.c>
|
|
<VirtualHost *:443>
|
|
ServerName ypchat.net
|
|
ServerAlias www.ypchat.net
|
|
|
|
# SSL-Konfiguration
|
|
Include /etc/letsencrypt/options-ssl-apache.conf
|
|
SSLCertificateFile /etc/letsencrypt/live/www.ypchat.net/fullchain.pem
|
|
SSLCertificateKeyFile /etc/letsencrypt/live/www.ypchat.net/privkey.pem
|
|
|
|
# DocumentRoot (optional, falls statische Dateien direkt serviert werden sollen)
|
|
DocumentRoot /opt/ypchat/docroot
|
|
|
|
<Directory /opt/ypchat/docroot>
|
|
AllowOverride None
|
|
Require all granted
|
|
</Directory>
|
|
|
|
# Spezielle Regel für /ads.txt
|
|
Alias /ads.txt /opt/ypchat/docroot/ads.txt
|
|
<Location /ads.txt>
|
|
Require all granted
|
|
</Location>
|
|
|
|
# Rewrite-Regeln für unerwünschte Query-Parameter
|
|
RewriteEngine On
|
|
RewriteCond %{QUERY_STRING} ^(.*)&?wtd=UrId0B0tLmuMAK9H&?(.*)$ [NC]
|
|
RewriteRule ^ %{REQUEST_URI}?%1%2 [R=301,L]
|
|
|
|
# WebSocket-Support für Socket.IO
|
|
# Wichtig: Diese Regeln müssen VOR den ProxyPass-Regeln stehen!
|
|
RewriteCond %{HTTP:Upgrade} websocket [NC]
|
|
RewriteCond %{HTTP:Connection} upgrade [NC]
|
|
RewriteRule ^/?(.*) "ws://localhost:4000/$1" [P,L]
|
|
|
|
# Reverse Proxy zu Node.js
|
|
ProxyPreserveHost On
|
|
ProxyPass /ads.txt !
|
|
ProxyPass / http://localhost:4000/
|
|
ProxyPassReverse / http://localhost:4000/
|
|
|
|
# Proxy-Einstellungen für WebSockets
|
|
ProxyRequests Off
|
|
ProxyTimeout 300
|
|
|
|
# Headers für HTTPS
|
|
RequestHeader set X-Forwarded-Proto "https"
|
|
RequestHeader set X-Forwarded-Port "443"
|
|
</VirtualHost>
|
|
</IfModule>
|
|
|