Hello,
I would have added this to the github wiki, but I don't have access to edit it ;). Feel free to post this information in the wiki. Here is an nginx configuration that gets dynmap properly serving through an nginx web server using an external web server (not proxying to dynmap). This information assumes the following:
Here is the nginx configuration that I am using to serve dynmap. My particular nginx setup uses php-fpm with an upstream defined named "php5-fpm.sock" to connect to php-fpm for the php processing.
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;
}
}
That config will get dynmap running through the root of the URL defined on the server_name line (adjust accordingly). On my particular server I am also running the (really excellent) multicraft web admin panel to control my servers with the web panel portion located at /srv/multicraft/ . Here is the full nginx config I use to also serve multicraft through a sub-URI of /admin/
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;
}
}
You need to make sure all of the standard external web server configs are done, that the user minecraft is running as has write permissions to the dynmap document root and that the web server has write permissions to the standalone/dynmap_webchat.json file (for webchat to work).
If you need details on how to get nginx up and running with php5-fpm I have a blog article I wrote on running wordpress with nginx, php5-fpm, apc and varnish. Just skip the wordpress and varnish portions and you will have nginx and php5-fpm (assuming you are on an ubuntu server). That article is located here http://www.cryptkcoding.com/2011/08/running-wordpress-with-nginx-php-fpm-apc-and-varnish/
Feel free to use as much or as little of this information as you like to work up an article on running dynmap through nginx as an external web server.
-Chris
Cool - added page to Wiki - thanks! (We turned off public edit after about the 10th time pages were either deleted or thoroughly screwed up by folks...)
WHAT O.o
What did you not use a proxy ? Is much easyer, try this :
proxy_cache_path /var/www/cache levels=1:2 keys_zone=map:8m max_size=1g inactive=24h;
server {
server_name THENAMEOFYOUDOMAIN (example : minecraft.yourdomain.com);
access_log /home/minecraft/logs/access.log; (its an exemple)
error_log /home/minecraft/logs/error.log; (its an exemple)
root /home/minecraft/server/plugins/dynmap/web; (root of you dynmap plugin this is mine)
location / {
proxy_pass http://youradresseordomain:8123/;
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;
}
}
This is what i used on my server. And its work perfectly, you dont need to install php.
I know this is an old post, but its the first on google ;)
Most helpful comment
WHAT O.o
What did you not use a proxy ? Is much easyer, try this :
This is what i used on my server. And its work perfectly, you dont need to install php.
I know this is an old post, but its the first on google ;)