I'm using Web.com to host a website for my MMO. I'm currently developing a simple server and testing it out on the web server. I've uploaded the server.jar file to the web server and now I can't figure out how to run it. How would I run it on the webserver?
Also the client would need an IP address to connect to, would that IP be the server's IP? And one more thing, what port should I use?
Any help would be greatly appreciated!
Web.com doesn't seem like the type of host you need for this. You'll need some sort of VPS-provider, such as AWS, DigitalOcean, or Linode. They'll give you a Linux virtual machine with SSH access, which is what you need to host your server.
To get SSH access after renting your server, you'll need an SSH client. On Linux and Mac, this is preinstalled - just run ssh <ip>
. On Windows, you'll need something like Putty.
Then, you'll need to add your server.jar
as a startup script. Linux distributions have various ways to do this, but the most common way (on recent Ubuntu versions, Arch Linux, and many other distributions) is through Systemd. Add a file like this to /etc/systemd/system/mmoserver.service
(nano
is a good terminal editor for newbies, run nano <path>
):
[Unit]
Description=MMO Server
[Service]
ExecStart=java -jar /path/to/server.jar -options=blahblahblah
[Install]
WantedBy=multi-user.target
Basically, this says when the server starts into multi-user mode (the normal mode, as opposed to single-user mode which is only when something breaks hard), it runs the ExecStart
command - your server. Now reboot and use ps aux
to verify your server is running. Pipe it to less
(ps aux | less
) to scroll using the arrow keys, use q
to exit less
.
You can find your VPS' external ip by running ifconfig
and looking for inet addr:...
. That said, you'll need the ip to SSH to it in the first place, so you'll probably already have it... :-)