External webserver: caught SyntaxError: Unexpected token '<'
smaartscz opened this issue · 25 comments
Issue Description: I have external webserver(nginx running in docker) to have access to dynmap while server is offline. I keep running into error(multiple errors to be precise): "caught SyntaxError: Unexpected token '<'"
My dynmap is configured to use MySQL(v5.5) database so missing tiles/ should not be issue
- Dynmap Version: core=3.5-873, plugin=3.5-873
- Server Version: Paper version git-Paper-538 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: bcd8dc2)
- Pastebin of Configuration.txt: https://pastebin.com/nQdBxNwT
- Server Host (if applicable): VPS with Pufferpanel for configuration
- Server log: https://pastebin.com/as5xfCvQ
- Steps to Replicate: Try to set up external webserver with nginx from this docker image: linuxserver/nginx:latest and use MariaDB: linuxserver/mariadb:arm32v7-latest, to have same setup try to use Pufferpanel(although it should not have any impact)
- I have looked at all other issues and this is not a duplicate
- I have been able to replicate this
looks like some files didn't got uploaded correctly or sth,
did you follow this guide? https://github.com/webbukkit/dynmap/wiki/External-Webserver-Basics
Yes I followed this guide. I also tried to copy files based on this guide
you don't have a hostname specified in the config, also, the guide I sent is solely for filetree storage, the one you sent is the one needed for mysql storage, and then you also need to change the url part of dynmap in configuration, you probably need to follow the nginx part option 1
Fixed that small mistake but it didn't have any impact on my issue. I sent this guide and try to follow it because it use mysql database as I want it.
Also if it helps internal web server works without issues(with mysql databse).
I tried multiple guides in this wiki but nothing worked(maybe they are outdated?)
yeah, but to make the external webserver understand the mysql, you need to change the url part also, as is stated here
This is my updated config: https://pastebin.com/u3DkNk73
Issue is not fixed.
AFAIK, when I specified webpath and this webpath is used by nginx it should be automatically updated, right?
I don't know for sure whether dynmap uses that as its location for dumping the url file for nginx
the urls should be visible in the web/standalone/config.js file, if that is there, then it is using that folder.
next step would be to check the nginx error.log under /var/log/nginx/error.log by default
This is my config.js file: https://pastebin.com/HiFb3ipG
to setup nginx to be able to use the mysql interfaces fefined in the standalone folder a config folder has to be set-up, its contents are the stuff you put in the url directive in configuration.
do you have a link to the map so I can check or is it still local only?
Sure, have a look here
there is something odd with your nginx config, look at the difference between the setup server's jquery.js: view-source:https://dynmap-setup.jurgenmk.nl/js/jquery-3.5.1.js?_=3.5-873 and yours: view-source:https://mc.smaarts.cz/smp/js/jquery-3.5.1.js?_=3.5-873 , (idk if this also works in other browsers, I use firefox)
Oh, I see now. There is probably issue with my reverse proxy, it keeps redirecting to puffepanel. Now we are moving somewhere! Check direct IP with port
Yep, there are errors, looks like I need check php addons: https://pastebin.com/VekenBJ6
no, addons are getting loaded, its complaining that there is no mysql_configuration.php
Permissions should not be issue.
I will try to put ip instead of localhost.
Edit: I tried to set 777 permissions(I know its not safe) but it still doesn't work
does it have the proper permissions? (user:group stuff)
and does that file contain the credentials you set in the dynmap mysql config part?
You are right, there are two containers - nginx and mariadb. I change localhost to vps ip and now it's working. Thank you for spending night with me and troubleshooting this mess.
It was dumb combination of misconfigured NPM and dumb mistake in docker networking.
localhost will point to the docker's 127.0.0.1, the mysql is not on that docker's network I think?
no worries, mistakes are easily made, glad it works! have fun with dynmap and have a nice rest of your evening!