Last active
April 6, 2024 23:58
-
-
Save 2called-chaos/4eacb303b9491d1e374c to your computer and use it in GitHub Desktop.
My nginx config for dynmap (on port 8123, that's the dynmap bound to localhost so no direct call possible)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@2called-chaos
Is there any reason for this other than preference?