以前nginxをリバースプロキシにしてdynmapを表示させる方法を書きましたが今回はnginx+php-fpmでdynmapを動かします

以前はこんな感じ

ユーザー=nginx=dynmap内蔵webサーバー=minecraftサーバー

今回のはこんな感じ

ユーザー=nginx=php-fpm=minecraftサーバー

/var/www/mapがドキュメントルートになる場合の設定
plugins/dynmap/webの中身を全て/var/www/mapにコピーしminecraftを実行するユーザーが書き込めるように権限を設定しておく

#cp -R /home/example/minecraft/plugins/dynmap/web/* /var/www/map
#chown -R example:example /var/www/map

nginx側の設定
/etc/nginx/conf.d/dynmap.conf

server {
  listen 80;
  server_name map.iroserver.net;
  root /var/www/map/;

  access_log /var/log/nginx/map_access.log;
  error_log /var/log/nginx/map_error.log;

  location / {
    index index.html;
  }
  location ~\.php$ {
  fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  include fastcgi_params;
  }
}

dynmapの設定
configuration.txt
– class: org.dynmap.InternalClientUpdateComponentからhidenames: falseまでコメントアウト
– class: org.dynmap.JsonFileClientUpdateComponentからhidenames: falseまでコメントアウトを解除
tilespathでファイル内を検索して出てきたあたりの設定を変更

# The path where the tile-files are placed.
tilespath: /var/www/map/tiles

# The path where the web-files are located.
webpath: /var/www/map

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