Add Apache proxy configuration for production

- Created apache-config.conf with proxy rules
- Added APACHE_FIX.md with step-by-step instructions
- Fixes 404 errors on /api and /socket.io endpoints
- Enables WebSocket support for multiplayer
This commit is contained in:
2025-12-21 16:13:02 +11:00
parent d7e9ab3529
commit 94e9510ddd
2 changed files with 161 additions and 0 deletions

43
apache-config.conf Normal file
View File

@@ -0,0 +1,43 @@
# Apache Configuration for Connect-5
# Add this to your Apache virtual host configuration
# Enable required modules (run these commands first):
# sudo a2enmod proxy
# sudo a2enmod proxy_http
# sudo a2enmod proxy_wstunnel
# sudo a2enmod rewrite
# sudo systemctl restart apache2
<VirtualHost *:443>
ServerName connect5.beyondcloud.technology
# Your existing SSL and document root settings
DocumentRoot /home/github2/apps/app-connect5
# Proxy API requests to Node.js
ProxyPreserveHost On
ProxyPass /api http://localhost:3000/api
ProxyPassReverse /api http://localhost:3000/api
# Proxy Socket.io WebSocket requests
ProxyPass /socket.io http://localhost:3000/socket.io
ProxyPassReverse /socket.io http://localhost:3000/socket.io
# WebSocket upgrade support
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:3000/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:3000/$1 [P,L]
# Your existing SSL configuration
SSLEngine on
# SSLCertificateFile /path/to/cert
# SSLCertificateKeyFile /path/to/key
</VirtualHost>
# If you also need HTTP (port 80) redirect:
<VirtualHost *:80>
ServerName connect5.beyondcloud.technology
Redirect permanent / https://connect5.beyondcloud.technology/
</VirtualHost>