• 欢迎来到Minecraft插件百科!
  • 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
  • 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289

“Dynmap”的版本间的差异

来自Minecraft插件百科
跳转至: 导航搜索
Centos+Nginx
C7w讨论 | 贡献
在Windows下建立动态地图插件
第381行: 第381行:
 
如果你们有关于Nginx+PHP5 FPM等的非 Dynmap类问题,可以前往 [http://www.cryptkcoding.com/2011/08/running-wordpress-with-nginx-php-fpm-apc-and-varnish/ 原作者的博客] 进行详细的提问。
 
如果你们有关于Nginx+PHP5 FPM等的非 Dynmap类问题,可以前往 [http://www.cryptkcoding.com/2011/08/running-wordpress-with-nginx-php-fpm-apc-and-varnish/ 原作者的博客] 进行详细的提问。
 
==在Windows下建立动态地图插件==
 
==在Windows下建立动态地图插件==
 +
我们猜测:
 +
 +
*你的Minecraft服务器目录位于D:\minecraft_server\。
 +
*你安装了最新的 CraftBukkit
 +
*你的Minecraft服务器托管在 localhost。
 +
安装并测试Dynmap:
 +
 +
*将 dynmap.jar 和文件夹 dynmap 复制到 D:\minecraft_server\plugins\.
 +
*(重新)启动你的Minecraft服务器
 +
*加入你的Minecraft服务器。
 +
*放置几个方块。
 +
*开启浏览器。
 +
*前往 http://localhost:8123/。
 +
 +
你应该看到了你的地图的名字显示在左上角。当你点击名字后,地图将会平移到你的位置,并且你应该看到了已经生成的一部分的世界。
 +
 +
发布
 +
 +
如果你想让地图能被其他的人访问,你需要做以下几步:
 +
 +
*将 TCP 端口 8123 转发。
 +
*将地图托管到大型Web服务器上,大型Web服务器必须能够访问Minecraft服务器,详细见下。
 +
 +
大型Web服务器
 +
 +
如果你正在托管一个 Apache 或者 Lighttpd 服务器,你可能想要让Dynmap地图可以被网页相同的URL访问,像 http://www.yourwebsite.com/dynmap/ 而不是 http://www.yourwebsite.com:8123/。如果是这样,你可以在下方选择你的Web服务器。
 +
 +
*IIS: 使用IIS的URL重写和ARR模块建立Dynmap(感谢Kekec852的帮助!);
 +
*IIS: 使用IIS建立Dynmap;
 +
(这还不是一个列表啊!如果你使用了其他的服务器,并且你知道如何配置它们,请将其添加至Wiki)
 +
===IIS+URL重写+ARR模块===
 +
这个页面猜测:
 +
 +
*你基本了解如何配置和管理IIS服务器。
 +
*Web服务器的根目录位于 C:\Inetpub\wwwroot\。
 +
*你的 IIS 和 CraftBukkit 在同一台机器运行。
 +
*你安装了[http://www.iis.net/downloads/microsoft/url-rewrite URL Rewrite]和[http://www.iis.net/downloads/microsoft/url-rewrite ApplicationRequestRouting]模块。
 +
 +
开始
 +
 +
*创建目录 C:\Inetpub\wwwroot\dynmap\。
 +
*将仓库找到的'web'文件夹下的内容放入 C:\Inetpub\wwwroot\dynmap\。
 +
 +
有两种选择:
 +
 +
*创建文件夹 C:\Inetpub\wwwroot\dynmap\tiles\ 并且编辑 configuration.txt 并且保证你的 tilespath 设置设置为 C:\Inetpub\wwwroot\dynmap\tiles\。
 +
<pre>
 +
# The path where the tile-files are placed.
 +
tilespath: C:\Inetpub\wwwroot\dynmap\tiles
 +
</pre>
 +
或者
 +
 +
*在IIS中创建虚拟文件夹,通过在IIS中右键Dynmap文件夹并点击 Add Virtual Directory 命名为 tiles (别名) 然后 Physical path 指向 dynmap插件文件夹/web/tiles
 +
 +
接着是重写的部分
 +
 +
*在IIS中选择Dynmap文件夹。点击URL Rewrite图标,接着 Add rule(s);选择 Reverse proxy。在入站规则(inbound rule)中输入 127.0.0.1:8123 并且点击ok。在询问是否启用反向代理(reverse proxy)时选择 Yes。
 +
*打开你的Web文件夹 (C:\Inetpub\wwwroot\dynmap\) 开启 web.config 然后将内容更改为:
 +
<pre>
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<configuration>
 +
    <system.webServer>
 +
        <rewrite>
 +
            <rules>
 +
                <clear />
 +
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
 +
                    <match url="up/(.*)" />
 +
                    <action type="Rewrite" url="http://127.0.0.1:8123/up/{R:1}" />
 +
                </rule>
 +
                <rule name="ReverseProxyInboundRule2" stopProcessing="true">
 +
                    <match url="standalone/(.*)" />
 +
                    <action type="Rewrite" url="http://127.0.0.1:8123/standalone/{R:1}" />
 +
                </rule>
 +
            </rules>
 +
        </rewrite>
 +
    </system.webServer>
 +
</configuration>
 +
</pre>
 +
有些版本的(7.x)的IIS不会自动给Dynmap需要的 *.json 文件分配正确的MIME类型(导致加载这些文件时出现406或者404错误,比如 Markers API)。
 +
 +
解决这个问题,请按照[http://support.microsoft.com/kb/942050 这里]的指示,来将MIME类型 'application/json' 定义为 'json' 文件拓展。
 +
 +
更多让IIS6和IIS7正确处理 JSON 的细节,请查看
 +
 +
http://www.sencha.com/forum/showthread.php?33266-Some-Problem-with-JSON&p=229858&viewfull=1#post229858
 +
 +
===IIS===
 +
这个页面猜测:
 +
 +
*你的Web服务器的地址为 C:\Inetpub\wwwroot\。
 +
*你的 IIS 和 CraftBukkit 在同一台机器运行。
 +
*你的 IIS 开启了 ASP.NET http://support.microsoft.com/kb/315122。
 +
 +
开始:
 +
 +
*创建目录 C:\Inetpub\wwwroot\dynmap\。
 +
*创建目录 C:\Inetpub\wwwroot\dynmap\tiles\。
 +
*将仓库找到的'web'文件夹下的内容放入 C:\Inetpub\wwwroot\dynmap\。
 +
 +
你现在应该有这个文件 C:\Inetpub\wwwroot\dynmap\up.aspx。
 +
 +
*前往 minecraft_server/plugins/dynmap/configuration.txt 并确保你将 tilespath 设置为 C:\Inetpub\wwwroot\dynmap\tiles\:
 +
<pre>
 +
  # The path where the tile-files are placed.
 +
  tilespath: C:\Inetpub\wwwroot\dynmap\tiles
 +
</pre>
 +
*重启你的Minecraft服务器
 +
*加入你的Minecraft服务器,随机放置一些方块,激活Dynmap生成tiles。
 +
 +
如果一切正常,你应该能在 C:\Inetpub\wwwroot\dynmap\tiles\ 找到一些新的 'PNG' 文件。你也可以前往 http://yourwebserver/dynmap/ 。
 +
 +
这时候应该显示地图,并且也会显示不能更新(玩家位置和地图更新)的错误。
 +
 +
创建或打开 C:\Inetpub\wwwroot\dynmap\standalone\config.js 文件,将内容替换为如下:
 +
<pre>
 +
    var config = {
 +
      url: {
 +
        configuration: 'up.aspx?path=configuration',
 +
        update: 'up.aspx?path=world/{world}/{timestamp}',
 +
        sendmessage: 'up.aspx?path=sendmessage',
 +
        login: 'up.aspx?path=login',
 +
        register: 'up.aspx?path=register',
 +
        tiles : 'tiles/',
 +
        markers : 'tiles/'
 +
      }
 +
    };
 +
</pre>
 +
现在刷新你的浏览器。现在应该在 http://mywebserver/dynmap/ 显示在线的玩家。
 +
 +
故障排除
 +
 +
前往你的Web服务器,开启一个浏览器。前往 http://localhost/dynmap/up.aspx?path=configuration。这里应该显示一些代表你的 configuration.txt 中配置的文本,如果显示的是一些错误,那么分析这些错误。如果你不确定要怎么做,请在 IRC 联系我们或者前往论坛求助。
 +
 +
有些版本的(7.x)的IIS不会自动给Dynmap需要的 *.json 文件分配正确的MIME类型(导致加载这些文件时出现406或者404错误,比如 Markers API)。解决这个问题,请按照这里的指示,来将MIME类型 'application/json' 定义为 'json' 文件拓展。
 +
 +
更多让IIS6和IIS7正确处理 JSON 的细节,请查看 http://www.sencha.com/forum/showthread.php?33266-Some-Problem-with-JSON&p=229858&viewfull=1#post229858
 +
 +
===通过托管服务建立Dynmap===

2018年7月22日 (日) 15:46的版本

Dynmap 是一个像谷歌地图一样的、为 Minecraft 服务器设计的地图插件,让你可以在浏览器查看地图。

你可以使用 Dynmap 的集成的网络服务器立即上手,也可以将其部署到 Apache 等现有的网络服务器,易于使用。

Dynmap 可以使用不同的渲染器渲染你的地图,有的适用于高性能,而有的可以展示更详细的细节。

原始的项目是由 k-red 开发。

联络方式

用户相关

不使用内部服务器安装

我们猜测

  • 你对你正在使用的独立Web服务器有相当的经验
  • 你的Web服务器与CraftBukkit运行在同一台机器上
  • 你的Web服务器支持PHP (仅用于Web到Minecraft的聊天)
  • 如果你在使用Linux,你应该知道如何使用终端和chmod。

将以下信息:

  - class: org.dynmap.InternalClientUpdateComponent
    sendhealth: true
    allowwebchat: true
    webchat-interval: 5
  #- class: org.dynmap.JsonFileClientUpdateComponent
  #  writeinterval: 1
  #  sendhealth: true
  #  allowwebchat: false

更改为

  #- class: org.dynmap.InternalClientUpdateComponent
  #  sendhealth: true
  #  allowwebchat: true
  #  webchat-interval: 5
  - class: org.dynmap.JsonFileClientUpdateComponent
    writeinterval: 1
    sendhealth: true
    allowwebchat: false

关闭内部更新机制并开启json文件更新机制,这将在 writeinterval 的间隔后在你的web路径写入文件 standalone/dynmap_world.json。

将 plugins/dynmap/web 中的文件复制进你的Web服务器中的某个文件夹,将 configuration.txt 的指向 tilespath 和 webpath 更改至你放置Web文件的地方。


Linux

# tile文件放置的路径
tilespath: /path/to/web/server/dynmap/web/tiles

# web文件放置的路径
webpath: /path/to/web/server/dynmap/web

或 Windows

# tile文件放置的路径
tilespath: c:\\path\\to\\web\\server\\dynmap\\web\\tiles

# web文件放置的路径
webpath: c:\\path\\to\\web\\server\\dynmap\\web

现在重启你的Minecraft服务器。加入你的服务器并(随机)放置一些方块来激活Dynmap给你的地图生成tiles。

你也可以输入 dynmap fullrender worldname 于你的服务器控制台来渲染整个 worldname 世界。

现在刷新你的浏览器,应该在 http://mywebserver/dynmap/ 显示你的在线人数,保持更新。

故障排除

如果你没有在地图看见任何tiles,检查tiles目录来查看他们是否已经被生成。如果没有任何tiles,那么可能Minecraft没有在web路径写入tiles的权限,或者你没有正确填写 tilespath 。

如果你没有看见任何玩家或者他们没有移动,前往 http://mywebserver/standalone/dynmap_world.json ( world 是世界的名称)。你应该能看见一些代码,并且随着时间流逝刷新能看见代码的改变、 如果没有这个文件或者这个文件没有更新,那么你可能填写了错误的 webpath 。

在 Linux,如果web到Minecraft的聊天没有工作,你应该 chmod 'standalone' 文件夹到 775 或者 777:

$ chmod -R 775 standalone

这允许 sendmessage.php 创建json文件。这一步是必须的,因为是你的Web服务器创建文件而不是Minecraft服务器。

如果在IIS web到Minecraft的聊天没有运行,你可能要安装PHP。

在Linux下建立动态地图插件

我们猜测

  • 你的Minecraft服务器目录为 /opt/minecraft_server/。
  • 你安装了最新的CraftBukkit
  • 你的Minecraft服务器托管于 localhost。

安装并测试Dynmap:

  • 将文件 dynmap.jar 和文件夹 dynmap 复制到 /opt/minecraft_server/plugins/。
  • 重启你的Minecraft服务器。
  • 加入你的Minecraft服务器。
  • 放置一些方块。
  • 开启浏览器。
  • 前往 http://localhost:8123/。

你应该在左上方看到了你的地图和名字。一旦你点击了名称,地图会平移到你的位置,你应该能看见一部分生成的地图。

发布 如果你想让你的地图能被其他人访问,你需要做这两步:

  • 将 TCP 端口 8123 转发。
  • 将地图托管到大型Web服务器上,大型Web服务器必须能够访问Minecraft服务器,详细见下。

大型Web服务器 如果你正在托管一个 Apache 或者 Lighttpd 服务器,你可能想要让Dynmap地图可以被网页相同的URL访问,像 http://www.yourwebsite.com/dynmap/ 而不是 http://www.yourwebsite.com:8123/。如果是这样,你可以在下方选择你的Web服务器。

  • Debian/Ubuntu 上的 apache2: 在Debian下使用Apache建立Dynmap;
  • Arch Linux 上的 apache/httpd: 在Arch Linux下使用apache/https建立Dynmap;
  • Arch Linux 上的 lighttpd: 在Arch Linux下使用Lighttpd建立Dynmap;
  • nginx 在Centos下使用Nginx建立Dynmap (由 LukeHandle 提供);

Debian+Apache

我们猜测:

  • 你安装了 Apache2。
  • 你的 www-root 目录在: /srv/http/。
  • 你应该可以通过 http://localhost:8123/ 成功访问Dynmap。

这个示例展示了如何将你的Dynmap部署在Apache的 http://mywebserver/dynmap/。

  • 先创建文件夹 /srv/http/dynmap/.
  • 将 web 目录下的文件复制到 /srv/http/dynmap/ 的zip包。

首先,我们需要开启需要的模组,输入以下命令:

    sudo a2enmod rewrite proxy_http

首先我们必须重定向 /dynmap/up/ 和 /dynmap/standalone/ 到Dynmap的内部Web服务器。

请保证你在 /etc/apache2/sites-available/default 后有这一段内容:

    ...
        Alias /dynmap/tiles /opt/minecraft_server/plugins/dynmap/web/tiles/

        RewriteEngine on
        RewriteRule /dynmap/up/(.*) http://localhost:8123/up/$1 [P,L]
        RewriteRule /dynmap/standalone/(.*) http://localhost:8123/standalone/$1 [P,L]
    </VirtualHost>

    <Directory /opt/minecraft_server/plugins/dynmap/web/tiles/>
        Order allow,deny
        Allow from all
    </Directory>

    <Proxy http://localhost:8123/*>
        Order deny,allow
        Allow from all
    </Proxy>

重启Apache2 (sudo /etc/init.d/apache2 restart).

现在应该在 http://mywebserver/dynmap/ 显示在线玩家了。

Arch Linux+apache/httpd

我们猜测:

  • 你安装了 apache-httpd。
  • 你的 www-root 目录在: /srv/http/。
  • 你应该可以通过 http://localhost:8123/ 成功访问Dynmap。

这个示例展示了如何将你的Dynmap部署在apache-httpd的 http://mywebserver/dynmap/。

  • 先创建文件夹 /srv/http/dynmap/.
  • 将 web 目录下的文件复制到 /srv/http/dynmap/ 的zip包。

在 /etc/httpd/conf/httpd.conf,保证你在有以下几段,注意,这些语句不必相邻。

    LoadModule proxy_module modules/mod_proxy.so
    LoadModule proxy_http_module modules/mod_proxy_http.so
    LoadModule rewrite_module modules/mod_rewrite.so

接下来,我们必须将 /dynmap/up/ 和 /dynmap/standalone 重定向到Dynmap的内部Web服务器。编辑以下内容到 /etc/httpd/conf/httpd.conf 的末尾:

    ...
    Alias /dynmap/tiles /opt/minecraft_server/plugins/dynmap/web/tiles/

    RewriteEngine on
    RewriteRule /dynmap/up/(.*) http://localhost:8123/up/$1 [P,L]
    RewriteRule /dynmap/standalone/(.*) http://localhost:8123/standalone/$1 [P,L]

    <Directory /opt/minecraft_server/plugins/dynmap/web/tiles/>
        Order allow,deny
        Allow from all
    </Directory>

    <Proxy http://localhost:8123/*>
        Order deny,allow
        Allow from all
    </Proxy>

注意这会对所有的VirtualHost生效,如果你有多个虚拟主机,那么推荐你将这些代码放入。

重启Apache/httpd (sudo /etc/rc.d/httpd restart)

现在应该在 http://mywebserver/dynmap/ 显示在线玩家了。

Arch Linux+Lighttpd

我们猜测:

  • 你安装了 lighttpd。
  • 你的 www-root 目录在: /srv/http/。
  • 你应该可以通过 http://localhost:8123/ 成功访问Dynmap。

开始

  • 先创建文件夹 /srv/http/dynmap/.
  • 将 web 目录下的文件复制到 /srv/http/dynmap/ 的zip包。

这个示例展示了如何将你的Dynmap部署在lighthttpd的 http://mywebserver/dynmap/。

在 /etc/lighttpd/lighttpd.conf,保证以下模块开启:

    server.modules = ( "mod_access",
    "mod_rewrite",
    "mod_proxy",
    "mod_fastcgi"
    )

现在我们需要让Web服务器的tiles可用,并且将代理 /dynmap/up/重定向至Dynmap的内部服务器。将以下内容添加至 /etc/lighttpd/lighttpd.conf 的末尾:

alias.url += ( "/dynmap/tiles/" => "/home/minecraft/minecraft_server/plugins/dynmap/web/tiles/" )

url.rewrite-once += ( 
        "^/dynmap/up/(.*)" => "/up/$1",
        "^/dynmap/standalone/(.*)" => "/standalone/$1"
)

$HTTP["url"] =~ "^/up/" {
        proxy.server = ( "" => (( "host" => "127.0.0.1", "port" => 8123 )) )
}
$HTTP["url"] =~ "^/standalone/" {
        proxy.server = ( "" => (( "host" => "127.0.0.1", "port" => 8123 )) )
}

重启 lighttpd (sudo /etc/rc.d/lighttpd restart)

现在应该在 http://mywebserver/dynmap/ 显示在线玩家了。

Centos+Nginx

在 CentOS 6.X 使用 Nginx 建立 Dynmap

介绍

之前我们介绍了使用Nginx(或者Apache)来建立你的Dynmap而不是内置的Jetty服务器,如果你正在托管你自己的网站(并且已经开放了80端口),那么这将允许你将你的地图建立在 http://map.example.com/ 而不是 http://map.example.com:8123/ (设置DNS记录超出了本文的讨论范围)。

注意:这篇文章猜测你的Web服务器与Minecraft服务器是分离的,这个例子里,我使用 192.168.1.2 建立Minecraft服务器而使用 192.168.1.3 建立Nginx服务器。

如果你选择在同一个服务器运行,那么请在配置里将192.168.1.2更改为127.0.0.1 - 只是记住这可能不是最好的解决方式(这时候代理可能有用?)。

CentOS

为什么是 CentOS?

来自 Wikipedia:

CentOS(Community Enterprise Operating System)是Linux发行版之一,它是来自于Red Hat Enterprise Linux依照开放源代码规定发布的源代码所编译而成。

由于出自同样的源代码,因此有些要求高度稳定性的服务器以CentOS替代商业版的Red Hat Enterprise Linux使用。

从安装的时候,我选择了'最小安装'的ISO,接着安装任何我可能需要的模块。

我推荐安装尽可能少的东西,接着添加缺少的东西而不是一次性安装所有的东西。

CentOS ISO镜像都在这里。

x86_64 最小安装 ISO 在 /6.X/isos/x86\_64/CentOS-6.X-x86_64-minimal.iso,这与你使用的镜像相关(X替换为最近的版本 - 本文写作的时候 - 6.4 - 翻译的时候已经7.4了)。

安装CentOS并在安装的时候设置好网络而不是启动时手动设置 /etc/sysconfig/network-scripts/ifcfg-eth0 来配置你的网络。

一个静态的IP地址是非常重要的,或者使用DHCP服务器(经常是路由器)。你可能需要配置SSHd,但这不是必须的。

安装 Nginx, PHP 和 PHP-FPM

按照这里或者网上的指示安装Nginx。这样如果你安装了 x86_64 CentOS 你就可以在root登陆下使用以下命令。

rpm -ivh http://mirror.yandex.ru/epel/6/x86_64/epel-release-6-7.noarch.rpm

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

在 "配置 Nginx" 部分,我个人使用了 /var/www/map.example.com/public_html 和 /var/www/map.example.com/logs,但这决定于你。

Note: Also create a folder for the cache eg. /var/www/cache and run chown nginx:nginx /var/www/cache.

设置"站点"

在 /etc/nginx/sites-available/map.example.com 的文件处,更改为以下信息。

    proxy_cache_path  /var/www/cache levels=1:2 keys_zone=map:8m max_size=1g inactive=24h;
server {
    server_name map.example.com;
    access_log /var/www/map.example.com/logs/access.log;
    error_log /var/www/map.example.com/logs/error.log;
    root /var/www/map.example.com/public_html;

    location / {
        proxy_pass                  http://[IP OF MINECRAFT SERVER]:9999/;
        proxy_set_header            Host $host;
        proxy_cache                 map;
        proxy_cache_key "$host$uri";
        proxy_cache_valid  200 302  60m;
        proxy_cache_valid  404      10m;
        proxy_cache_use_stale       error timeout invalid_header updating http_500 http_503 http_504;
        proxy_connect_timeout 10;
    }
}

将 proxy_pass 更改为你的Dynmap服务器的IP和端口。

完成

运行这个命令: service nginx reload 来重载命令

保证 80 端口被防火墙(iptables)开放,并且公共IP有一个DNS的A记录连接到 map.example.com 域名。

打开 http://map.example.com

Nginx

这里介绍了如何使用Nginx作为外部Web服务器搭建Dynmap 网页服务(非代理服务器)。 我们推测你已经完成了以下步骤:

  • 你所安装的 Dynmap 根目录在 /srv/dynmap
  • 你正确地安装了 Nginx 服务,并且懂得如何使用它来搭建一台PHP在线聊天系统
  • 你所安装的 Dynmap 和内置网页服务器已经正确运行在 8123 端口

以下展示出 Dynmap 运行在Nginx时的默认配置文件。为了更好的进行数据处理,我特意将Nginx中的php-fpm配置命名为 "php5-fpm.sock"。

server {
    listen       80;
    server_name  minecraft.example.com;
    root         /srv/dynmap/;

    index index.html;

    access_log /var/log/nginx/minecraft.example.com-access_log;
    error_log /var/log/nginx/minecraft.example.com-error_log;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_index index.php;
        fastcgi_pass php5-fpm-sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }
}

这些配置会运用到 Dynmap 下所有的URL行中。

如果你想使用 MultiCraft 作为 Dynmap 的后台管理系统也是极好的。

以下是使用Nginx搭建 Dynmap 时使用 MultiCraft 管理的配置:

server {
    listen       80;
    server_name  minecraft.example.com;
    root         /srv/dynmap/;

    index index.html;

    access_log /var/log/nginx/minecraft.example.com-access_log;
    error_log /var/log/nginx/minecraft.example.com-error_log;

    location / {
        try_files $uri $uri/ =404;
    }

    location /admin {
        alias /srv/multicraft/;
        index index.php;
    }

    location ~ ^/admin/(.*\.php)$ {
        alias /srv/multicraft/$1;
        fastcgi_pass php5-fpm-sock;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        include /etc/nginx/fastcgi_params;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_index index.php;
        fastcgi_pass php5-fpm-sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
    }
}

你需要在确保以上所有步骤正确完成以及配置项无误后,你还需要给 Dynmap 和网页服务器对 standalone/dynmap_webchat.json 文件赋予足够的读写权限用于网页在线聊天系统。

如果你们有关于Nginx+PHP5 FPM等的非 Dynmap类问题,可以前往 原作者的博客 进行详细的提问。

在Windows下建立动态地图插件

我们猜测:

  • 你的Minecraft服务器目录位于D:\minecraft_server\。
  • 你安装了最新的 CraftBukkit
  • 你的Minecraft服务器托管在 localhost。

安装并测试Dynmap:

  • 将 dynmap.jar 和文件夹 dynmap 复制到 D:\minecraft_server\plugins\.
  • (重新)启动你的Minecraft服务器
  • 加入你的Minecraft服务器。
  • 放置几个方块。
  • 开启浏览器。
  • 前往 http://localhost:8123/。

你应该看到了你的地图的名字显示在左上角。当你点击名字后,地图将会平移到你的位置,并且你应该看到了已经生成的一部分的世界。

发布

如果你想让地图能被其他的人访问,你需要做以下几步:

  • 将 TCP 端口 8123 转发。
  • 将地图托管到大型Web服务器上,大型Web服务器必须能够访问Minecraft服务器,详细见下。

大型Web服务器

如果你正在托管一个 Apache 或者 Lighttpd 服务器,你可能想要让Dynmap地图可以被网页相同的URL访问,像 http://www.yourwebsite.com/dynmap/ 而不是 http://www.yourwebsite.com:8123/。如果是这样,你可以在下方选择你的Web服务器。

  • IIS: 使用IIS的URL重写和ARR模块建立Dynmap(感谢Kekec852的帮助!);
  • IIS: 使用IIS建立Dynmap;

(这还不是一个列表啊!如果你使用了其他的服务器,并且你知道如何配置它们,请将其添加至Wiki)

IIS+URL重写+ARR模块

这个页面猜测:

  • 你基本了解如何配置和管理IIS服务器。
  • Web服务器的根目录位于 C:\Inetpub\wwwroot\。
  • 你的 IIS 和 CraftBukkit 在同一台机器运行。
  • 你安装了URL RewriteApplicationRequestRouting模块。

开始

  • 创建目录 C:\Inetpub\wwwroot\dynmap\。
  • 将仓库找到的'web'文件夹下的内容放入 C:\Inetpub\wwwroot\dynmap\。

有两种选择:

  • 创建文件夹 C:\Inetpub\wwwroot\dynmap\tiles\ 并且编辑 configuration.txt 并且保证你的 tilespath 设置设置为 C:\Inetpub\wwwroot\dynmap\tiles\。
# The path where the tile-files are placed.
tilespath: C:\Inetpub\wwwroot\dynmap\tiles

或者

  • 在IIS中创建虚拟文件夹,通过在IIS中右键Dynmap文件夹并点击 Add Virtual Directory 命名为 tiles (别名) 然后 Physical path 指向 dynmap插件文件夹/web/tiles

接着是重写的部分

  • 在IIS中选择Dynmap文件夹。点击URL Rewrite图标,接着 Add rule(s);选择 Reverse proxy。在入站规则(inbound rule)中输入 127.0.0.1:8123 并且点击ok。在询问是否启用反向代理(reverse proxy)时选择 Yes。
  • 打开你的Web文件夹 (C:\Inetpub\wwwroot\dynmap\) 开启 web.config 然后将内容更改为:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <clear />
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="up/(.*)" />
                    <action type="Rewrite" url="http://127.0.0.1:8123/up/{R:1}" />
                </rule>
                <rule name="ReverseProxyInboundRule2" stopProcessing="true">
                    <match url="standalone/(.*)" />
                    <action type="Rewrite" url="http://127.0.0.1:8123/standalone/{R:1}" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

有些版本的(7.x)的IIS不会自动给Dynmap需要的 *.json 文件分配正确的MIME类型(导致加载这些文件时出现406或者404错误,比如 Markers API)。

解决这个问题,请按照这里的指示,来将MIME类型 'application/json' 定义为 'json' 文件拓展。

更多让IIS6和IIS7正确处理 JSON 的细节,请查看

http://www.sencha.com/forum/showthread.php?33266-Some-Problem-with-JSON&p=229858&viewfull=1#post229858

IIS

这个页面猜测:

开始:

  • 创建目录 C:\Inetpub\wwwroot\dynmap\。
  • 创建目录 C:\Inetpub\wwwroot\dynmap\tiles\。
  • 将仓库找到的'web'文件夹下的内容放入 C:\Inetpub\wwwroot\dynmap\。

你现在应该有这个文件 C:\Inetpub\wwwroot\dynmap\up.aspx。

  • 前往 minecraft_server/plugins/dynmap/configuration.txt 并确保你将 tilespath 设置为 C:\Inetpub\wwwroot\dynmap\tiles\:
  # The path where the tile-files are placed.
  tilespath: C:\Inetpub\wwwroot\dynmap\tiles
  • 重启你的Minecraft服务器
  • 加入你的Minecraft服务器,随机放置一些方块,激活Dynmap生成tiles。

如果一切正常,你应该能在 C:\Inetpub\wwwroot\dynmap\tiles\ 找到一些新的 'PNG' 文件。你也可以前往 http://yourwebserver/dynmap/

这时候应该显示地图,并且也会显示不能更新(玩家位置和地图更新)的错误。

创建或打开 C:\Inetpub\wwwroot\dynmap\standalone\config.js 文件,将内容替换为如下:

    var config = {
      url: {
        configuration: 'up.aspx?path=configuration',
        update: 'up.aspx?path=world/{world}/{timestamp}',
        sendmessage: 'up.aspx?path=sendmessage',
        login: 'up.aspx?path=login',
        register: 'up.aspx?path=register',
        tiles : 'tiles/',
        markers : 'tiles/'
      }
    };

现在刷新你的浏览器。现在应该在 http://mywebserver/dynmap/ 显示在线的玩家。

故障排除

前往你的Web服务器,开启一个浏览器。前往 http://localhost/dynmap/up.aspx?path=configuration。这里应该显示一些代表你的 configuration.txt 中配置的文本,如果显示的是一些错误,那么分析这些错误。如果你不确定要怎么做,请在 IRC 联系我们或者前往论坛求助。

有些版本的(7.x)的IIS不会自动给Dynmap需要的 *.json 文件分配正确的MIME类型(导致加载这些文件时出现406或者404错误,比如 Markers API)。解决这个问题,请按照这里的指示,来将MIME类型 'application/json' 定义为 'json' 文件拓展。

更多让IIS6和IIS7正确处理 JSON 的细节,请查看 http://www.sencha.com/forum/showthread.php?33266-Some-Problem-with-JSON&p=229858&viewfull=1#post229858

通过托管服务建立Dynmap