Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Add Wiki Page] Dynmap + Nginx + No Internal Web Server #2027

Closed
jwshields opened this issue Dec 7, 2016 · 8 comments
Closed

[Add Wiki Page] Dynmap + Nginx + No Internal Web Server #2027

jwshields opened this issue Dec 7, 2016 · 8 comments

Comments

@jwshields
Copy link

Hello,
I'd like to propose a Wiki page for setting up Dynmap with Nginx and not using the internal Dynmap webserver.
The code blocks below are edited to my configuration, which works.

Prereqs:

  1. Have a working bukkit config ( I currently run Minecraft as user minecraft and have my server located in /home/minecraft/minecraft/ )
  2. Have nginx installed (on Debian, default nginx root directory is /var/www/html/ )
  3. Have php5-fpm installed

Instructions:

  1. Download Dynmap and run Bukkit/Spigot to have it generate the Skeleton files for your configuration
  2. Edit your Dynmap configuration.txt
    2.1. https://github.com/webbukkit/dynmap/blob/9f835b497808e81afc456487a83039524d1620e4/src/main/resources/configuration.txt
  3. View codeblock 1 below from configuration.txt, edit your config to be similar to this (lines 40-96)
    3.1. This disables the internal client update and enabled Dynmap writing to JSON
  4. View codeblock 2 below from configuration.txt, edit your config to be similar to this (lines 308-331)
    4.1 This section disables the internal web server, changes the path to where tiles & web files are stored
    4.2 I did an absolute path for the web and tiles area, it's currently the default location, and is not needed to make this change, but I prefer having hardcoded paths
  5. For a configuration like this, changing lines 431-446 is not needed, but I will include codeblock 3 below to show that these do need to be commented out
  6. Edit your nginx configuration to something similar to this (my nginx config is located at /etc/nginx/sites-enabled/default )
    6.1. On my server I have dynmap at http://myserver/map/
    6.2. Add a symlink to your www directory (this points nginx to /home/minecraft/minecraft/plugins/dynmap/web/ when it receives a request for URI /map/ [ or on your system it's read as the file path /var/www/html/map/ ] )
    6.2.1. ln -s /home/minecraft/minecraft/plugins/dynmap/web/ /var/www/html/map/
    6.3. In your Nginx site, add a location block for php (See codeblock 4)
  7. Edit your php5-fpm config to use a TCP/IP socket rather than a Unix Socket
    7.1. /etc/php5/fpm/pool.d/www.conf
    7.2. Change the listen line to whatever port you want, only make sure it matches with what the Nginx block says
    7.3. listen = 127.0.0.1:8999
  8. Restart Nginx
  9. Restart php5-fpm
  10. Start Bukkit and let the magic happen

configuration.txt 1

(lines 40-96)

  # - class: org.dynmap.InternalClientUpdateComponent
  #   sendhealth: true
  #   sendposition: true
  #   allowwebchat: true
  #   webchat-interval: 5
  #   hidewebchatip: false
  #   trustclientname: false
  #   includehiddenplayers: false
  #   # (optional) if true, color codes in player display names are used
  #   use-name-colors: false
  #   # (optional) if true, player login IDs will be used for web chat when their IPs match
  #   use-player-login-ip: true
  #   # (optional) if use-player-login-ip is true, setting this to true will cause chat messages not matching a known player IP to be ignored
  #   require-player-login-ip: false
  #   # (optional) block player login IDs that are banned from chatting
  #   block-banned-player-chat: true
  #   # Require login for web-to-server chat (requires login-enabled: true)
  #   webchat-requires-login: false
  #   # If set to true, users must have dynmap.webchat permission in order to chat
  #   webchat-permissions: false
  #   # Limit length of single chat messages
  #   chatlengthlimit: 256
  # #  # Optional - make players hidden when they are inside/underground/in shadows (#=light level: 0=full shadow,15=sky)
  # #  hideifshadow: 4
  # #  # Optional - make player hidden when they are under cover (#=sky light level,0=underground,15=open to sky)
  # #  hideifundercover: 14
  # #  # (Optional) if true, players that are crouching/sneaking will be hidden 
  #   hideifsneaking: false
  #   # If true, player positions/status is protected (login with ID with dynmap.playermarkers.seeall permission required for info other than self)
  #   protected-player-info: false
  #   # If true, hide players with invisibility potion effects active
  #   hide-if-invisiblity-potion: true
  #   # If true, player names are not shown on map, chat, list
  #   hidenames: false
  - class: org.dynmap.JsonFileClientUpdateComponent
    writeinterval: 1
    sendhealth: true
    sendposition: true
    allowwebchat: true
    webchat-interval: 5
    hidewebchatip: false
    includehiddenplayers: false
    use-name-colors: false
    use-player-login-ip: false
    require-player-login-ip: false
    block-banned-player-chat: true
    hideifshadow: 0
    hideifundercover: 0
    hideifsneaking: false
    # Require login for web-to-server chat (requires login-enabled: true)
    webchat-requires-login: false
    # If set to true, users must have dynmap.webchat permission in order to chat
    webchat-permissions: false
    # Limit length of single chat messages
    chatlengthlimit: 256
    hide-if-invisiblity-potion: true
    hidenames: false

configuration.txt 2

(lines 308-331)

# The path where the tile-files are placed.
tilespath: /home/minecraft/minecraft/plugins/dynmap/web/tiles

# The path where the web-files are located.
webpath: /home/minecraft/minecraft/plugins/dynmap/web


# The path were the /dynmapexp command exports OBJ ZIP files
exportpath: export

# The network-interface the webserver will bind to (0.0.0.0 for all interfaces, 127.0.0.1 for only local access).
# If not set, uses same setting as server in server.properties (or 0.0.0.0 if not specified)
#webserver-bindaddress: 0.0.0.0

# The TCP-port the webserver will listen on.
#webserver-port: 8123

# Maximum concurrent session on internal web server - limits resources used in Bukkit server
#max-sessions: 30

# Disables Webserver portion of Dynmap (Advanced users only)
disable-webserver: true

# Enable/disable having the web server allow symbolic links (true=compatible with existing code, false=more secure (default))
allow-symlinks: false

configuration.txt 3

lines 431-446

# URL for client configuration (only need to be tailored for proxies or other non-standard configurations)
url:
    # configuration URL
    #configuration: "up/configuration"
    # update URL
    #update: "up/world/{world}/{timestamp}"
    # sendmessage URL
    #sendmessage: "up/sendmessage"
    # login URL
    #login: "up/login"
    # register URL
    #register: "up/register"
    # tiles base URL
    #tiles: "tiles/"
    # markers base URL
    #markers: "tiles/"

nginx site configuration

        location ~ \.php$ {
        try_files $fastcgi_script_name =404;
        gzip off;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:8999;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi.conf;
        }
@chuushi
Copy link

chuushi commented Dec 7, 2016

There's already a wiki for using external webserver in this wiki,m albeit not in full detail. More people seems to want to use the proxy instead of the JSON file way. https://github.com/webbukkit/dynmap/wiki/Setting-up-without-the-Internal-Web-Server

@jwshields
Copy link
Author

I am well aware of that wiki page.

  1. That page is geared toward Windows/IIS with a bit of *nix sprinkled in
  2. it does not include all the changes necessary to make the switch
  3. Recommending users chmod 777 or chmod 776 is incredibly insecure and not a good practice, just to get PHP to work

Also, the nginx proxy is broken in parts and does not work properly, for example, broken https and files 404ing because there's no good instructions on url rewrites and the Dynmap jetty instance isn't really configurable.

@chuushi
Copy link

chuushi commented Dec 8, 2016

For me, everything works well without using

gzip off;
fastcgi_pass 127.0.0.1:8999;

and not using step 7. Is there any reason for their inclusion? I am just curious.

I do wish the wiki was editable.

@jwshields
Copy link
Author

I included step 7 because that's how my config is. It's not necessary and I'd assume most others have PHP set up, but I thought I'd throw it in just in case.

@wioxjk
Copy link

wioxjk commented Dec 9, 2016

@jwshields
Please include a guide to set up Reverse Proxy also.
This is a working configuration that I created
http://serverfault.com/questions/799012/dynmap-throu-mod-proxy-on-a-external-webserver

the map:
https://mc.selea.se/map

@Kervinou
Copy link

Hi
it'll be very good to safe MC server, but where are dynmap plugins ?
example : plotsquared or precious stones plugins for dynmap are invisible

is it the same for you ?
thanks

@chuushi
Copy link

chuushi commented Mar 26, 2017

@Kervinou, Please create a separate issue. This issue is not about misc. Dynmap plugins.

@NatoBoram
Copy link

I agree that the current documentation on the subject is inefficient and lacks explanations on each and every changes to be made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants