-
-
Save 2called-chaos/4eacb303b9491d1e374c to your computer and use it in GitHub Desktop.
server { | |
listen 80; | |
server_name map.geekya.com; | |
# I normally wouldn't disable the access log but here I see no problem with it | |
access_log off; | |
error_log /var/log/nginx/com.geekya.map.error.log; | |
# custom error page when map isn't available | |
error_page 502 503 504 =503 /503_map.html; | |
location = /503_map.html { | |
root /home/www/com.geekya/current/public; | |
} | |
# serve statics | |
location ~ ^/(tiles|css|images|js)/ { | |
root /home/geekyamc/_main/plugins/dynmap/web; | |
expires 0; | |
add_header Cache-Control private; | |
break; | |
} | |
# forward anything else to the dynmap webserver | |
location / { | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_read_timeout 6; | |
# That is my dynmap webserver which is only accessible via localhost or through nginx | |
proxy_pass http://127.0.0.1:8123; | |
break; | |
} | |
} |
The gist for my nginx.conf
file mentioned by Kyle above is here.
I would recommend you to not do this with subdirectories (it will just give you headaches). I would recommend subdomains. You can then proxy_pass to as many different ports/dynmap as you want, each with their own hostname/subdomain.
You can still either make a redirect for // to .domain.tld or iframe the maps on your main page. I did the latter with just a fixed iframe spanning the whole viewport, only downside in that case is that users can't easily copy deeplinks.
I would recommend you to not do this with subdirectories (it will just give you headaches). I would recommend subdomains.
@2called-chaos My setup doesn't allow that, nor do I want that. But I'll keep it in mind just in case I need it, but everything is working fine here and is easily expandable. Thanks.
I would recommend you to not do this with subdirectories (it will just give you headaches).
Is there any reason for this other than preference?
Has been a while with dynmap for me and it might just work with it in this case but many web applications don't like it do be in a subdirectory. You then have to start rewriting URLs and then you might have emails with wrong links or some other edge cases.
Thank you for this. I've been smashing by head through my keyboard trying to get my nginx to work with a remote dynmap server. This helped a lot.
I know this is a few months old but I'm hoping there's someone that might come across this that knows the answer I'm looking for.
I need more than one dynmap instance behind one Nginx reverse proxy. At the moment this config only allows for one instance but I would like to know if it's possible to do the following:
If anyone knows the solution, either reply here or if you have Discord if you could contact me on that preferably,
Kyle#0420
EDIT: Thank you Ben on Discord for helping me out :)