Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[How to] Linux map file server

#1
This is a how to on setting up a file host for your maps if you are running on Linux, either on a VPS or Dedicated server. With this how to you'll only have to have maps in one location vs normally done with two, one inside your .xonotic/data folder and one on the map host.

I'm going to assume you have your Linux distro installed already and basic secured. I'll be doing this for Ubuntu server but should the same for most distros. I'm also going to assume that you have Xonotic already downloaded and for GIT version compiled it.


Now open up a command line window

In the /home/your_name/.xonotic folder make a directory called maps

Code:
mkdir maps

Now lets install lighttpd

Code:
sudo apt-get install lighttpd

Accept all the install defaults, usually just type in y or Y

Now type in

Code:
sudo nano /etc/lighttpd/lighttpd.conf

This will bring up the lighttpd config file in the nano editor.

Check that the following lines are not commented out. They should't be anyways.

Code:
server.modules = (
        "mod_access",

Leave this line as it for now. You can set it to what ever you want later.

Code:
server.document-root        = "/var/www"

Change this line

Code:
url.access-deny             = ( "~", ".inc")

to

Code:
url.access-deny             = ( "~", ".inc", ".cfg", ".db", ".txt" )

This will make the server make these file extensions unavailable through the browser. Just in-case you upload them to the wrong folder.


Now add this line below it. It will deny access to any file in the maps/data dir. Not sure if its needed but why not.

Code:
# deny access to /maps/data
$HTTP["url"] =~ "^/maps/data/" {
     url.access-deny = ("")
}

Click CTRL+x and then Y to save the changes.

Now type in

Code:
service lighttpd restart

Now type in

Code:
cd /var/www

which will take you to the /var/www directory. Here will we create a symlink that points to /home/your_name/.xonotic/maps

Now type in

Code:
sudo ln -s /home/your_name/.xonotic/maps maps

Open up you serer.cfg file and look for this like

Code:
// see Docs/mapdownload.txt for more info
sv_curl_defaulturl ""  //fallback download URL

Uncomment it by remove the # before sv_curl_defaulturl and make it look like this with your info

Code:
// see Docs/mapdownload.txt for more info
sv_curl_defaulturl "http://your_ip/maps/"  //fallback download URL

This will tell the player client where it should download the next map from.


With this your .pk3 map files will be downloadable for the players when they join your server. They will also be downloadable from the browser if the user goes to say your_site.com/maps.

Now when you want to upload your map files they just have to be uploaded to one location /home/your_name/.xonotic/maps

For the final set up

When you start your xonotic server you'll need do use the -game switch like this

For GIT
Code:
./all run dedicated -game maps

This will tell the game to use the /home/your_name/.xonotic/data/maps directory for the map .pk3 files. Your server.cfg can and should now be placed in the /home/your_name/.xonotic/data directory and not /home/your_name/.xonotic/maps

Depending on how popular your server is and how many maps you are hosting, having the map server on the same box might cause some lag when players are downloading maps. I haven't noticed this but might be noticeable on a small VPS.
[MoFo] Servers - North America - Hosted in Kansas USA - Admin DeadDred [MoFo]
Reply

#2
+1
Reply

#3
I'll add some screen shots to this a bit later.
[MoFo] Servers - North America - Hosted in Kansas USA - Admin DeadDred [MoFo]
Reply

#4
Using "-game maps" is weird. Does your server show in the server list at all when you do that? Why not instead keep "data" and configure lighttpd to have "maps" point to that directory.

In any case, I would advise against making your server data directory the document root. You are putting every single file (except for your crypto key, thankfully) of your dedicated server on a web server. That's generally a bad idea. Though you do revoke access to specific extensions, you can't predict every pattern that non-map files will follow on your server. For example, here you're making savegames and server demos accessible.

Instead of this, I would advise that you put your maps in .xonotic/maps or anywhere else you would like to, and create symbolic links from your server's data directory to that map directory. That way, you can ditch mod_access and have full control over what files are accessible rather than relying on guesses that end up exposing data that you don't necessarily want out in the public.
Reply

#5
(10-19-2014, 01:47 PM)Mr. Bougo Wrote: Using "-game maps" is weird. Does your server show in the server list at all when you do that? Why not instead keep "data" and configure lighttpd to have "maps" point to that directory.

In any case, I would advise against making your server data directory the document root. You are putting every single file (except for your crypto key, thankfully) of your dedicated server on a web server. That's generally a bad idea. Though you do revoke access to specific extensions, you can't predict every pattern that non-map files will follow on your server. For example, here you're making savegames and server demos accessible.

Instead of this, I would advise that you put your maps in .xonotic/maps or anywhere else you would like to, and create symbolic links from your server's data directory to that map directory. That way, you can ditch mod_access and have full control over what files are accessible rather than relying on guesses that end up exposing data that you don't necessarily want out in the public.

The symlink is from /var/www to .xonotic/maps not .xonotic/data/maps for the -game switch this is what Mario suggested. The user would only put maps/server_packages to the .xonotic/maps folder while the other data like server.cfg stays in .xonotic/data

Also

Code:
# deny access to /maps/data
$HTTP["url"] =~ "^/maps/data/" {
     url.access-deny = ("")
}

This give a 403 Forbidden to any file/dir under the .xonotic/maps/data dir.

Ok I guess if I don't have to use the -game switch and the game will use the .xonotic/maps then yes it would be better that way and symlink from .xonotic/maps to /var/www/maps

I'll have to test this locally first.
[MoFo] Servers - North America - Hosted in Kansas USA - Admin DeadDred [MoFo]
Reply

#6
Sure, .xonotic/maps/data is blocked, but .xonotic/maps/sv_autodemos is not. Same thing about savegames, for which you can't predict a file name pattern. Those features aren't used very often, but IIRC autodemos can contain sensitive data like rcon or master passwords. And I'm possibly missing other files that are written in the data directory.

Considering that, I would recommend that users exert caution if they follow your guide above in its current form.
Reply

#7
(10-19-2014, 03:56 PM)Mr. Bougo Wrote: Sure, .xonotic/maps/data is blocked, but .xonotic/maps/sv_autodemos is not. Same thing about savegames, for which you can't predict a file name pattern. Those features aren't used very often, but IIRC autodemos can contain sensitive data like rcon or master passwords. And I'm possibly missing other files that are written in the data directory.

Considering that, I would recommend that users exert caution if they follow your guide above in its current form.

Ok so I can either add all the available dir's under .xonotic/maps to be excluded or I can block all files BUT pk3 to be served.

Code:
$HTTP["url"] !~ "\.(pk3)$" {
  url.access-deny = ( "" )
}
[MoFo] Servers - North America - Hosted in Kansas USA - Admin DeadDred [MoFo]
Reply

#8
Sure, that might work too. I personally prefer physically separating the data you want to serve, it seems less foolproof to me. Your new suggestion looks reasonable however.
Reply

#9
I thought you were supposed to speak English in this forum Blush
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  Docker Xonotic Dedicated Server ich777 15 2,510 10-08-2020, 11:15 AM
Last Post: BuddyFriendGuy
  BuddyFriendGuy Fun Server BuddyFriendGuy 22 7,957 10-08-2020, 11:14 AM
Last Post: BuddyFriendGuy
Rainbow Kotangєns' independent server Kotangens 2 432 10-07-2020, 05:08 AM
Last Post: L497
  RaspberryPi4 Server ablyveiled 2 636 08-19-2020, 10:36 PM
Last Post: ballerburg9005
Question [NEED HELP] Server uses 40% CPU whereas Nexuiz server runs with max 10% e-pig 6 2,060 08-19-2020, 10:17 PM
Last Post: ballerburg9005
  [SOLVED] I can't create my server. Kotangens 11 1,043 07-22-2020, 04:42 AM
Last Post: Kotangens
Information [SOLVED] Server stops when I close command prompt on my PC Jewel 2 497 06-01-2020, 07:11 AM
Last Post: Jewel
  Server Hosting Issue Saevus 2 547 04-30-2020, 06:16 PM
Last Post: Saevus
  Server error "Weapon stats writing failed: -404" FlufyBuny 2 1,051 04-08-2020, 02:41 PM
Last Post: jwabbitt
  [NEED HELP] Server dont appear in server browser abslimit 0 558 03-15-2020, 04:13 AM
Last Post: abslimit

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-