Setting up a web server, easy way

Hello all!

Today, there will be no code but only the explanation about my migration to a new server. As told in previous posts, my demo server (dvtrsc.somee.com) was hosted for free, so applying “what you pay is what you get”, I got then a very slow Windows 2008 Server, with adds and limited bandwidth and as well not-so-much memory. Was enough for basic tests, but if you want some more perfomance and as well to realize some more big projects, you need a little more power. So, decided to migrate to a new one.

Many of the actual hosting solutions are related to web hosting only. That’s a good idea if you only think in published webs in common web servers projects (apache, iis, etc) but due I’d like in a future create some tcp/ip servers, and possibly some experiments (pushing, mongodb, etc) I prefer then got more control of it. So, decided then for a VPS server with Debian 7, and full root access.

So, first of all, I got a VPS server in a hosting. The one of my election was in ovh, but there’s a lot at very good prices (mine was 3.49$/m, 2.99€/m) or completely free (cloudrino, for example). Beware! because as in everything there are misleading and cheating pages (beware about 5jelly, yocats, and sadly a lot more…). You can get trusted information in this discussion forum, freevps.

OK. So I got my rented VPS server. As told, it has only by default SO installed (Debian 7). As soon as got root user credentials, we begin to install some things. First of all, we connect  to server using ssh (you can use putty and another tools if your source SO is not Linux)

nnn@nnn-desktop:~$ ssh vpsXXXXXX.ovh.net -l root 

We are now inside our new VPS. We are going to install first xsp, the light webserver used by monodevelop. As explained in it’s page, xsp it’s not the most complete, reliable or configurable web server, but it’s enough for us to check out web publication. Let’s realize first an apt-get update to load configured ppa’s.

# apt-get update

Now, we search for the correct xsp package name & install it.

# apt-get install mono-xsp4

We’re going to prepare a small page so we can publish it as test. Lets create the dirs.

# cd /home
# mkdir publishing
# cd publishing

Let’s create the aspx as well using cat (remember to press ctrl+d when finish to detach the file from stdin)

/home/publishing# cat > index.aspx
<html><body><a>Hey there!This is working!</a></body></html>

So we got a webserver, a page…that’s all then! Lets execute xsp :

# xsp4 --root /home/publishing --port 80 
xsp4
Listening on address: 0.0.0.0
Root directory: /home/publishing
Listening on port: 80 (non-secure)
Hit Return to stop the server.

xsp is working! lets check our page in a browser…snapshot2

Great! there’s just only one more thing. Due processes are attached to the ssh session, we must use nohup with our process to compulse it to not accept HUP signal when detaching ssh root session, so our xsp process will be still working in background.

So, we finish our current session of xsp pressing return, and restart xsp with nohup, executing:

# nohup xsp4 --root /home/publishing --port 80 --nonstop &

We can check output from nohup process using tail against nohup.out, that will be created in same dir where executed nohup

# tail -f nohup.out

As well, we can confirm that process xsp is still working,

/home/publishing# ps aux | grep xsp
root      9498  0.2  0.8  52964 16948 pts/1    Sl   15:51   0:00 /usr/bin/mono /usr/lib/mono/4.0/xsp4.exe --root /home/publishing --port 80 --nonstop

And now, yes, we can disconnect from our VPS session being sure xsp will still be working on there.

root@vpsXXXXXX:/home/publishing# logout
Connection to vpsXXXXXX.ovh.net closed.
nnn@nnn-desktop:~$ 

That’s all! You got your page working from scratch. In a future, if you want to upload files from your develop machine to that server, you can use scp, as well install a ftp server or use a general tool, or perhaps your host got some kind of tool panel to do that.

Note that demo urls in this blog had been changed to the new one. Feel free to check out new better performance.

In next posts, we will install mongodb, and try some code with AngularJs, and we will as well develop a push/notification service, etc…

Hope will be useful to you!

Best regards,

 

 




Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s