Closed itzMiney closed 2 months ago
After much experimenting and digging through the source code with programmer friends I found that the plugin creates a webserver that listens on the port defined in the config.yml under
# Web server port (Not Minecraft server port!)
Port: 1989
so in order for the webserver to work in nginx you need a config something like this on the same server:
server {
listen 80;
listen [::]:80;
server_name bp.example.com;
return 301 https://bp.example.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name bp.example.com;
root /path/to/MinecraftServer/plugins/BlockParty/web;
index index.html;
location / {
try_files $uri $uri/ =404;
}
# Proxy requests for the BlockParty API
location /api {
proxy_pass http://localhost:1989; # Sub-server's port
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Proxy requests for the NameRequest endpoint
location /NameRequest {
proxy_pass http://localhost:1989; # Ensure this is correctly routing to the plugin's web server
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Proxy requests for the Musicplayer endpoint
location /Musicplayer {
proxy_pass http://localhost:1989; # Ensure this is correctly routing to the plugin's web server
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# SSL Configuration - Replace the example with your SSL Certificate paths
ssl_certificate /etc/letsencrypt/live/bp.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/bp.example.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256';
ssl_prefer_server_ciphers on;
}
idk what I'm doing wrong but I tried to set up the webserver using nginx and it doesn't work I can see the website but when I try to enter a username the Confirm button does nothing looking at the browser console it tells me that the endpoints for /Musicplayer and /NameRequest are 404 not found