LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

Yes, You Can Run 18 Static Sites on a 64MB Link-1 VPS

One thing I hated about WebHostingTalk is how much bad advice the so-called “professionals” are giving out to the world. Some poor college student asked in the VPS forums whether he is able to run 18 static HTML sites on VPSLink.com Link-1 plan (64MB RAM, 2.5GB storage & 100GB/month data), and the typical responses are:

“I do not believe you can host 18 websites on 64MB of RAM. I’d bump that up to at least 128 or 256.” –nexbyte

“I really wouldn’t advise anything lower than 265MB RAM for website hosting.” –RikeMedia

(Well, there are some more optimistic comments but I mainly list out those “with things to sell”)

So, just trying to prove the point that yes, 64MB is more than enough to host 18 static sites, I decided to add a Link-1 Xen to my account and document the process. Btw, thanks to Dan @ VPSLink for getting my billing issue resolved :) You can get 10% recursive discount here, or 66% off for the first 3 months here.

Setting Up the VPS

After my order has been provisioned, I re-image the server with a Debian 5 “Lenny” image. I normally pick Debian or Ubuntu because apt-get uses much less memory than RedHat/Fedora’s equivalent, and it’s also my personal preference. I named my new VPS “endor” as I usually just name my boxes after Star Wars systems. Re-imaging a VPS is pretty fast — 2 minutes later I have my root password sent to my email address so I can ssh in to set up the new system.

$ ssh root@endor
root@endor's password:
Linux 66671 2.6.18-53.1.13.el5xen #1 SMP Tue Feb 12 14:04:18 EST 2008 i686

endor:~# free
             total       used       free     shared    buffers     cached
Mem:         65704      64008       1696          0       5616      44100
-/+ buffers/cache:      14292      51412
Swap:       131064          0     131064
endor:~# cat /proc/cpuinfo
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel(R) Core(TM)2 Duo CPU     E4500  @ 2.20GHz
stepping        : 13
cpu MHz         : 2194.496
cache size      : 2048 KB
fdiv_bug        : no
hlt_bug         : no
f00f_bug        : no
coma_bug        : no
fpu             : yes
fpu_exception   : yes
cpuid level     : 10
wp              : yes
flags           : fpu tsc msr pae mce cx8 apic mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc up pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips        : 5558.81

Plenty of free memory and a single core of C2Duo E4500 — although not a high-end Xeon CPU, but should be more than sufficient to do what we need it to do. The next thing I want to do is to make sure every package is up to date.

endor:~# apt-get update && apt-get upgrade
Get:1 http://debrepo.mirror.vpslink.com lenny Release.gpg [386B]
Get:2 http://debrepo.mirror.vpslink.com lenny Release [63.2kB]
Get:3 http://debrepo.mirror.vpslink.com lenny/main Packages [5295kB]
Get:4 http://security.debian.org lenny/updates Release.gpg [197B]
Get:5 http://security.debian.org lenny/updates Release [40.8kB]
Get:6 http://debrepo.mirror.vpslink.com lenny/contrib Packages [76.1kB]
Ign http://security.debian.org lenny/updates/main Packages/DiffIndex
Get:7 http://security.debian.org lenny/updates/contrib Packages [14B]
Get:8 http://security.debian.org lenny/updates/main Packages [50.6kB]
Fetched 5526kB in 4s (1330kB/s)
Reading package lists... Done
...

Setting Up Web Server

Okay. The 64MB VPS is now up and running. What should we do next? Installing a web server of course, so we can start serving our static pages! Which web server? Definitely not Apache as it would be a waste of valuable memory here. Again my personal favourite is Nginx (pronounces Engine X), which currently powers LowEndBox.com. However, in this exercise I will go for Lighttpd because I found it easier to set up for abitary sites.

First of all — get Lighttpd installed.

endor:~# apt-get install lighttpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
...
Setting up libterm-readkey-perl (2.30-4) ...
Setting up libterm-readline-perl-perl (1.0302-1) ...
Setting up lighttpd (1.4.19-5) ...
Starting web server: lighttpd.
endor:~# ps -u www-data u
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
www-data  1690  0.0  1.5   5416  1008 ?        S    07:17   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf

Plain vanilla stripped down and un-configured 32 bit Lighttpd sits around 1MB RSS — not bad.

Next, we need to get our websites up there and point Lighttpd to them. It’s a good idea to put the web sites in an organised structure inside the file system. I usually just place them this way:

  • /var/www/<hostname>/html

So if I have an HTML file at http://www.example.com/testing.html, it will sit on the file system at /var/www/www.example.com/html/testing.html. Unfortunately I do not have 18 static sites. For testing purpose I am only going to display a very basic HTML page at http://test.lowendbox.com/.

endor:~# mkdir -p /var/www/test.lowendbox.com/html
endor:~# echo '<h1>Low End Box Rocks!</h1>' > /var/www/test.lowendbox.com/html/index.html

So now our “website” is ready — how does Lighttpd, our webserver, knows where to find the files corresponding to the website? That’s where Lighttpd’s mod_simple_vhost comes in handy.

endor:~# lighttpd-enable-mod simple-vhost
Available modules: auth cgi fastcgi proxy rrdtool simple-vhost ssi ssl status userdir
Already enabled modules:
Enabling simple-vhost: ok
Run /etc/init.d/lighttpd force-reload to enable changes
endor:~# /etc/init.d/lighttpd force-reload
Stopping web server: lighttpd.
Starting web server: lighttpd.

Now navigate to test.lowendbox.com (which already has an A record to my new VPS’s IP address) — here we have it! Low End Box Rocks!!!

Prerequisite:
You must be already familiar with DNS and know how to create records to point to IP addresses. For free DNS hosting I recommend EveryDNS, which has also been hosting LowEndBox’s domain.

You can now basically just dump static files at /var/www/<hostname>/html, with <hostname> resolved to your VPS’s IP address, and you will have your static websites over there in no time. You do not even need to tell Lighttpd to reload, as mod_simple_vhost automatically maps the hostname to appropriate file name. Repeat it 18 times and problem solved!

At 1 single testing site with no traffic, Lighttpd sits at around 1.5MB RSS, although I doubt it would increase significantly when you increase the number of sites or the traffic. Lighttpd and Nginx are single-threaded poll-based asynchronised web servers so for static file serving, the bottle-neck would be disk/network IO rather than amount of memory or CPU performance.

There are still lots of memory left. Maybe we can have some fun.

Installing WordPress

So you think, “hey Low End Box rocks and it runs on WordPress. So maybe I will have that installed as well!” Wow. But WordPress is a content management system for creating dynamic websites! It simply cannot be possible on a 64MB VPS, the WHT crowd says! Grrr!! Let’s give it a try.

To run WordPress from your static-file serving Lighttpd, you need a few more packages — namely MySQL and PHP in CGI/FastCGI mode.

endor:~# apt-get install mysql-server php5-cgi php5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
...
Creating config file /etc/php5/cgi/php.ini with new version
Setting up php5-mysql (5.2.6.dfsg.1-1+lenny2) ...
Setting up sgml-base (1.26) ...
Setting up xml-core (0.12) ...
Setting up mailx (1:20071201-3) ...

I know it installs whole lot of other junks but don’t worry — we will live with them first and will try to optimise later. It also requires you to set up the root password for MySQL server, and I conveniently chose the most obscured password in this exercise — “root” (yes, don’t use that because I am already using it as my root password :)

We then need to configure lighttpd to handle PHP files.

endor:~# cat > /etc/lighttpd/conf-enabled/10-cgi-php.conf
server.modules += ("mod_cgi")
cgi.assign = (".php" => "/usr/bin/php5-cgi")^D
endor:~# /etc/init.d/lighttpd force-reload
Stopping web server: lighttpd.
Starting web server: lighttpd.

Done! It should be able to serve PHP files. Just to test it out:

endor:~# echo '<?php phpinfo(); ?>' > /var/www/test.lowendbox.com/html/phpinfo.php

Now navigate to http://test.lowendbox.com/phpinfo.php — you should be able to see the output of phpinfo() function. What we are going to do next is to set up a WordPress blog under http://test.lowendbox.com/blog/. WordPress.org already provides a great tutorial on installing WordPress, but let’s do it step by step on the command prompt.

My plan:

  • Create database “test_blog”
  • Download the latest WordPress and unzip to test.lowendbox.com/blog
  • Set up configuration file and run the WordPress install
  • Update Lighttpd to provide clean URL, aka Pretty Permalinks.

Let’s go!

endor:~# mysqladmin -uroot -proot create test_blog
endor:~# wget http://wordpress.org/latest.tar.gz
Resolving wordpress.org... 72.233.56.138, 72.233.56.139
Connecting to wordpress.org|72.233.56.138|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: `latest.tar.gz'

...

2009-03-17 13:03:15 (1.01 MB/s) - `latest.tar.gz' saved [1624416]

endor:~# tar zxf latest.tar.gz -C /var/www/test.lowendbox.com/html
endor:~# cd /var/www/test.lowendbox.com/html
endor:/var/www/test.lowendbox.com/html# mv wordpress blog
endor:/var/www/test.lowendbox.com/html# mv blog/wp-config-sample.php blog/wp-config.php
endor:/var/www/test.lowendbox.com/html# vi blog/wp-config.php

When you are editing WordPress’ configuration file, set DB_NAME to “test_blog”, DB_USER and DB_PASSWORD to “root” for something quick, dirty and potentially insecure. Here is one final step — navigate to http://test.lowendbox.com/blog/, and WordPress will guide you through the rest of setup.

It is also relatively easy to set up pretty permalinks for WordPress on Lighttpd. In our example,

endor:~# cat > /etc/lighttpd/conf-enabled/lowendbox.conf
$HTTP["host"] == "test.lowendbox.com" {
    $HTTP["url"] =~ "^/blog/" {
        server.error-handler-404 = "/blog/index.php"
    }
}^D
endor:~# /etc/init.d/lighttpd force-reload
Stopping web server: lighttpd.
Starting web server: lighttpd.

That’s it! You can now go into WordPress to configure the desirable Permalink Structure. Do note that the current WordPress dashboard page is very resource intensive, as it fetches development blog, other WP news, incoming links, etc from various sources, concurrently on separate PHP CGI processes. There might be plugins to turn off this server-killing behavior (or just use older version of WordPress like 2.0.x which is still maintained). Likewise some WP caching plugin can be very useful in reducing the load. Google them and you shall find.

Optimisation — Squeeze More Memory!

So now we have a Debian 5 web server box that can handle lots of static sites + a few WordPress blogs, and it fits “fine” on a 64MB Xen VPS. Let’s see what processes are running:

endor:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
...
root       325  0.0  0.4   2032   292 ?        S<s  04:25   0:00 udevd --daem
root       879  0.0  0.4   2788   304 ?        Ss   Mar17   0:00 /bin/bash --
root      1216  0.0  0.0      0     0 ?        S    Mar17   0:00 [pdflush]
root      1649  0.0  0.2   3144   188 ?        Ss   Mar17   0:00 /usr/sbin/famd 
root      6427  0.0  4.4   8024  2928 ?        Ss   Mar17   0:00 sshd: root@pts/
root      6429  0.0  2.3   2804  1564 pts/0    Ss   Mar17   0:00 -bash
root      6441  0.0  1.8  33092  1200 ?        Sl   Mar17   0:00 /usr/sbin/rsysl
root      6453  0.0  1.4   5284   976 ?        Ss   Mar17   0:00 /usr/sbin/sshd
root      6470  0.0  1.3   2048   896 ?        Ss   Mar17   0:00 /usr/sbin/cron
daemon    6482  0.0  0.8   1772   560 ?        Ss   Mar17   0:00 /sbin/portmap
www-data  6510  0.0  2.6   5848  1736 ?        S    Mar17   0:00 /usr/sbin/light
root      6572  0.0  1.7   2488  1156 pts/0    S    Mar17   0:00 /bin/sh /usr/bi
mysql     6611  0.0 26.2 143652 17228 pts/0    Sl   Mar17   0:00 /usr/sbin/mysql
root      6613  0.0  0.8   1636   536 pts/0    S    Mar17   0:00 logger -p daemo
103       6973  0.0  1.3   6112   908 ?        Ss   Mar17   0:00 /usr/sbin/exim4
root      6986  0.0  1.3   2308   908 pts/0    R+   00:01   0:00 ps aux
endor:~# free
             total       used       free     shared    buffers     cached
Mem:         65704      51424      14280          0        936      22588
-/+ buffers/cache:      27900      37804
Swap:       131064        864     130200

Note that it’s an idle box. The swap is slightly used and at 37MB free it is actually not too bad. Let’s try to squeeze a little bit more memory out from the factory setup.

MySQL is by far the biggest offender, and I have talked about how to reduce MySQL memory usage here. If you are just running simple CMS, InnoDB is probably not required — it uses more memory and a lot heavier on IO as well. We can simply use the LxAdmin’s mysql.cnf which I linked on the other blog post to get the bare-minimum MySQL running.

endor:~# cat > /etc/mysql/conf.d/lowendbox.cnf
[mysqld]
key_buffer = 16K
max_allowed_packet = 1M
table_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 64K
skip-bdb
skip-innodb^D

As mysqld_safe script uses /bin/sh for scripting, it’s also a good idea to check whether dash is used instead of bash.

endor:~# apt-get install dash
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
...
Unpacking dash (from .../dash_0.5.4-12_i386.deb) ...
Processing triggers for man-db ...
Setting up dash (0.5.4-12) ...
endor:~# dpkg-reconfigure dash
Adding `diversion of /bin/sh to /bin/sh.distrib by dash'
Adding `diversion of /usr/share/man/man1/sh.1.gz to /usr/share/man/man1/sh.distrib.1.gz by dash'
endor:~# /etc/init.d/mysql restart
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..

One thing I don’t like about Debian 5 is its default inclusion of rsyslog. Well — it’s feature rich, but I don’t need MySQL and TCP syslog support. Weight at 1.2MB RSS is just a bit too fat I reckon. I am not game enough to go without a syslog daemon, so I just go for syslog-ng. Probably not the most light weight, but it’s just something I have been using for the last couple of years.

endor:~# ps -C rsyslogd v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 6441 ?        Sl     0:00      0   207 32936  1260  1.9 /usr/sbin/rsyslogd -c3
endor:~# apt-get install syslog-ng && dpkg --purge rsyslog
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
...
Setting up syslog-ng (2.0.9-4.1) ...
Starting system logging: syslog-ng.
(Reading database ... 16517 files and directories currently installed.)
Removing rsyslog ...
Purging configuration files for rsyslog ...
endor:~# ps -C syslog-ng v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 8215 ?        Ss     0:00      0   105  2754   708  1.0 /usr/sbin/syslog-ng -p 

Shedding 500kb RSS — not too bad I guess :)

Next — Portmap and FAM got installed when Lighttpd was first installed. Lighttpd does not really need FAM. It’s used for stat cache to reduce seeks, but can live without. Not that I have noticed any performance difference anyway for small traffic anyway. Having both of them removed from the process list would give us extra 750KB.

endor:~# apt-get remove --purge portmap
eading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
...

OpenSSH can be replaced by dropbear to save memory.

endor:~# touch /etc/ssh/sshd_not_to_be_run
endor:~# apt-get install dropbear
...
endor:~# vi /etc/default/dropbear
endor:~# /etc/init.d/dropbear start
Starting Dropbear SSH server: dropbear.

Just remember to set NO_START=0 in /etc/default/dropbear so dropbear can run as a daemon. Dropbear daemon is using around 500KB less than OpenSSH daemon during idle, and for each connection it uses 1.5MB less on this Debian 5 box — that’s quite a saving!

That’s probably it! Vixie cron can be replaced by a light weight DCRON but I can’t seem to be able find it in Debian’s repository. Exim4 is probably one of the most light weight mail daemon you can have, but then again you might want to question — “do I need a mail daemon running”? You can probably bring it down, and just run /usr/sbin/runq once every 2 hours to process the queue, in case the previous delivery failed. That would probably give you another 1MB to play with.

You can also use PDKSH to replace BASH as interactive shell to loose some weight.

endor:~# ps -C bash v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 8409 pts/1    Ss     0:00      2   663  2140  1568  2.3 -bash
endor:~# apt-get install pdksh
endor:~# chsh -s /bin/pdksh
<log out and then SSH back in>
# ps -C pdksh v
  PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
 8550 pts/0    Rs     0:00      0   174  1633   588  0.8 -pdksh

That’s 1 full megabyte off the scale! Also note that VPSLink’s /etc/inittab automatically spawn a BASH process on the console — just in case you got locked out from firewall. For me it’s the last line of inittab file. Change it to /bin/sh or /bin/pdksh, run init q to reload init(1), and then kill that bash process.

Here’s the end result:

# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
...
root       325  0.0  0.4   2032   292 ?        S<s  Mar17   0:00 udevd --daem
root      1216  0.0  0.0      0     0 ?        S    Mar17   0:00 [pdflush]
root      6470  0.0  1.3   2048   896 ?        Ss   Mar17   0:00 /usr/sbin/cron
103       6973  0.0  1.3   6112   912 ?        Ss   Mar17   0:00 /usr/sbin/exim4
root      7953  0.0  0.7   1716   524 ?        S    00:23   0:00 /bin/sh /usr/bi
mysql     7992  0.0  8.2  37904  5404 ?        Sl   00:23   0:00 /usr/sbin/mysql
root      7994  0.0  0.8   1636   536 ?        S    00:23   0:00 logger -p daemo
root      8215  0.0  1.1   2860   776 ?        Ss   00:31   0:00 /usr/sbin/syslo
www-data  8313  0.0  2.4   5712  1640 ?        S    00:37   0:00 /usr/sbin/light
root      8418  0.0  0.7   2052   468 ?        Ss   00:51   0:00 /usr/sbin/dropb
root      8527  0.0  0.7   1712   468 ?        Ss   01:19   0:00 /bin/sh --
root      8549  0.0  1.9   2712  1300 ?        Ss   01:21   0:00 /usr/sbin/dropb
root      8550  0.0  0.9   1808   600 pts/0    Rs   01:21   0:00 -pdksh
root      8562  0.0  1.3   2308   908 pts/0    R+   01:26   0:00 ps aux
# free
             total       used       free     shared    buffers     cached
Mem:         65704      58852       6852          0       2180      40344
-/+ buffers/cache:      16328      49376
Swap:       131064        380     130684

That’s 12MB trimmed, which can be used in disk cache to improve static file serving.

Conclusion

So how do we conclude? 64MB is more than enough to serve a few low traffic static websites. You can actually run a few WordPress sites with a few hundred visitors a day — at the price equivalent to many heavily oversold shared hosting and you get root access!

One thing about root access though — in all my examples above I used root account and never bothered to use a normal user account. It is bad from security aspect so don’t do it. Or at least don’t tell anyone that you use nothing but root :)

LEA
Latest posts by LEA (see all)

174 Comments

  1. Excellent work! If you need a DNS server, you can use maradns, that cost you only 2MB :)
    And if you need ftp, I recomend pure-ftpd.
    I always use root to do everything. Can you tell me why its wrong and what should I do in place?

    March 18, 2009 @ 11:40 am | Reply
  2. @Marcos — for DNS, I just out source it unless I am running a DNS cluster. For FTP — Oh well it’s 21st century and FTP should have been left there for dead 15 years ago…

    As of not always logging in as root, it’s so that you don’t accidentally do something stupid, like running “rm -rf ./” but then forgot to put in the dot…

    March 18, 2009 @ 12:13 pm | Reply
    • more important – if you run a local linux or even unix like I do, it happens that you start typing command into the wrong console. Like me last time, wanting to reboot my internet router, instead sending the command to my VPS. Using a (unsupported) debian there, that reboot command hook there, and I had to contact support for the machine to be actually rebooted. Also it’s kind of damned to work as root as u usually should run services etc as user(in case some bad guy hijacks that service, he could get root rights, and we dont want that, do we?), and those services need access to the files they shall serve(e.g. you run a webserver as user, but you copied the files to wwwroot as root, so the webserver has no read access, because with copying them you took ownership). Therefore, weirdest things may happen because a service just has no rights to open a specific file…

      June 12, 2011 @ 12:37 am | Reply
      • cheapdave:

        Using the same technique (typing into the wrong console), I once installed firefox from rpmforge on a production CentOS server.

        Naturally I realised immediately what I had done and could undo the damage as I hadn’t done much.

        Shit happens.

        December 31, 2013 @ 8:49 am | Reply
    • Lol! I hate FTP. Even on a really quick connection it takes forever to upload files.

      May 4, 2012 @ 2:21 pm | Reply
  3. Thodoris:

    Hello, when i am trying to install mysql i get the error “Cannot allocate memory”.. Why?

    March 20, 2009 @ 5:40 pm | Reply
  4. @Thodoris — probably because you picked openvz VPS rather than xen VPS.

    Also if the memory allocation error comes up when you start the MySQL, try to disable the InnoDB first.

    March 21, 2009 @ 12:44 pm | Reply
  5. Thodoris:

    I have picked up a openvz vps but maybe i will take the vpslink’s first plan..

    What do you prefer? Xen or OpenVZ?

    March 21, 2009 @ 2:25 pm | Reply
  6. I mostly prefer Xen

    March 21, 2009 @ 5:46 pm | Reply
  7. Link to the forum post is no longer valid, as is most of the WHT offers linked to. Looks like WHT’s backups got hit pretty bad.

    March 23, 2009 @ 8:56 pm | Reply
  8. @Chuck — indeed. Hopefully WHT did not follow my post and try to run the whole vBullitin system on a 64MB VPS! LOL.

    March 23, 2009 @ 10:19 pm | Reply
  9. heh ya, though it’d be interesting to see how long it would take to load in that case. That actually brings up an idea for another experiment: How heavy of a forum can you run an a 64mb VPS? Might be worth looking into sometime

    March 24, 2009 @ 12:42 am | Reply
  10. Nickolai Leschov:

    Great article!

    I have just found your site while googling for its topic i.e. low end hosting. It’s great that there is a site dedicated to just this topic. I’m going to do some experimental work with network technologies and I would like to figure out how to make the most of low-end server I can get.

    I heard that NetBSD is very effective i.e. runs great on low-end VPS’es. To check how much of this is true, I installed NetBSD 4.0.1 on my computer. Running “ps aux” doesn’t give me memory totals; here’s a screenshot of running top (obviously, no X):
    http://www.flickr.com/photos/22022497@N04/3387465817/sizes/m/
    can you tell if this is low memory consumption? As far as I can see, not exactly.
    The system has 2 GB of RAM, with no integrated video, tha should be 2048 MB of RAM. Top shows 1977M free, that means 71M is used – this isn’t exactly very low, is it? But on the other hand “9008K Act + 388K Wired + 3000K Exec + 3760K File + 1977M Free” doesn’t add up to 2048M. Can you please help me sort this out?

    I’m not going to be maniacally obsessed with optimization, but it seems to me very worthwhile to know if there are significant gains to be had by running NetBSD instead of a Linux.

    March 26, 2009 @ 9:21 pm | Reply
    • @Nikolai, there’s two things to be aware off – VPS usually provide the offered memory without the base system need. your system needs additional mem for kernel and stuff.
      second thing is caching – at least linux and solaris eat up as much memory as they can for caching. If the mem is actually needed, they will release it promptly

      June 12, 2011 @ 12:40 am | Reply
  11. @Nickolai — sorry I came from the land of Penguins and am not familiar in the land of Daemons…

    March 26, 2009 @ 10:45 pm | Reply
  12. I’m not an expert, but that sounds alot like the RAM is being reserved for the OS. Whenever I used NetBSD I found that systems with very little RAM (eg, <256mb) would have under a couple megs of RAM used by the OS

    March 26, 2009 @ 10:46 pm | Reply
  13. Nickolai Leschov:

    I come from the land of Windows actually, so the workings of Linux and NetBSD are equally something to be learned for me. I was going to rent a low end Linux box for my experiments, but if NetBSD, as advertised, would have a much smaller memory footprint, I could just as well use it.

    To my (poor) understanding, for now it seems that modern NetBSD system won’t have significantly lower memory footprint on low-end box. Maybe I should just use Debian per LowEndAdmin’s suggestion. That’s what many admins use on servers, after all.

    March 27, 2009 @ 3:15 pm | Reply
  14. NetBSD does in general have a lower footprint, but is also much harder to configure than Debian. Though when it’s configured properly, optimized a little, and left alone to perform its task it will barely ever have a problem related to resources.

    If your new to the land of Linux/BSD’s then you should definitely be using either Ubuntu or Debian Etch on your systems. Their package system is ridiculously easy to use, not to mention full of plenty of software to keep you busy.

    March 28, 2009 @ 2:43 am | Reply
  15. Hi, great guide. I’m curious, do you hard code the HTML/colour markup of your command line outputs in your post above? If not, do you use any specific WordPress plugin for this markup?

    May 1, 2009 @ 2:26 pm | Reply
  16. @Sunny — no WordPress plugin has been tortured to produce the command line output. All are “Hand Coded in Vim (TM)”

    May 2, 2009 @ 9:41 am | Reply
  17. I’m not sure if this is right, but i think you missed a part:

    When installing virtual hosting for lighttpd, dont you have to edit ‘/etc/lighttpd/lighttpd.conf’, and change ‘server.document-root = “/var/www//html”‘

    Great post!

    May 20, 2009 @ 3:14 am | Reply
  18. @Mir — no you don’t. With the mod_simple_host it will have dynamic document root depending on the hostname passed in.

    May 20, 2009 @ 3:49 am | Reply
  19. Oh ok. I have another question, what if i enter the ip address of the vps?, like “http:///lowendbox.com/

    And if someone enters the ip address what domain does it go to?

    Thanks, and sorry for all the questions.

    May 20, 2009 @ 4:42 am | Reply
  20. @Mir — if you read the documentation on the mod_simple_host module on Lighttpd’s site, there’s a configuration for the “default host”, i.e.

    simple-vhost.default-host = ‘example.com’

    In this case, all hosts that cannot be mapped to a query (including IP based) will go under /var/www/example.com/html

    May 20, 2009 @ 4:47 am | Reply
  21. Ok thanks for all of your help and (very) quick responses!!

    May 20, 2009 @ 4:54 am | Reply
  22. Thanks for the article. It was a great inspiration to get off my rear and get off of shared hosting and get back into a VPS. I’m running very similar to what you’re using, with debian 5, lighttpd, dropbear, (no mysql… prefer sqlite) etc. with only about 13MB of ram used. Serving almost 1500 pages a day and not even breaking a sweat, on a VPSLink 64 meg box. It can be done!

    May 24, 2009 @ 12:07 am | Reply
  23. Nickolai Leschov:

    diffra, what kind of site are you running and how much traffic does it use at 1500 pages a day ?

    May 26, 2009 @ 9:38 pm | Reply
  24. The website the he linked to (click on his name) appears to be hosted on VPSLink — so I guess it’s one of them?

    May 27, 2009 @ 12:10 am | Reply
  25. LowEndAdmin is correct. It’s actually a collection of sites… maybe 15 total. most of the traffic is either dynamically generated images for forum signatures, or googlebot. For the record, I’m moving most of this over to slicehost after VPSLink’s latest outage. I’ve just had too many problems, even for a personal box. All my ‘production’ stuff runs on a 512MB apache slice, so i’m going to squeeze my Link1 into a slightly more roomy 256MB box.

    May 31, 2009 @ 6:29 am | Reply
  26. Good Tutorial…thanks ;)

    July 3, 2009 @ 4:08 pm | Reply
  27. I followed this guide but I’m running at 50mb. :(

    September 12, 2009 @ 12:06 am | Reply
  28. soy:

    hi. thanks for this tutorial.
    can u someday write about setting up website with wordpress/drupal but with nginx?

    thanks

    October 1, 2009 @ 7:23 am | Reply
  29. Hello lowendboxadmin. I am a newbie on building webservers and i am planning to host a website of our school, a K12 school from the philippines. I found your tutorial very nice, can this be enough to deploy a website for our school? or for the whole division probably? Any nice friendly advise if what i’ll be needing most?

    Thanks.

    October 6, 2009 @ 7:29 am | Reply
  30. VpsLink is indeed a good option. I monitor your site from few months and response time graph is pretty good:

    http://site-uptime.net/su.cgi/en/report?publicKey=p3b7x8kynk9zedn1ejkhfdr9q95nv2pv

    October 6, 2009 @ 7:02 pm | Reply
  31. ALip BudiNTO:

    “Or at least don’t tell anyone that you use nothing but root :)” I use root at the time!

    October 11, 2009 @ 8:03 pm | Reply
  32. vamsi:

    Hi..How can I add
    a website completely instead of a hostname
    like in my registrar I can add *.mydomain.com to point to an ip.
    please reply..
    thanks in advance :)

    October 19, 2009 @ 1:59 pm | Reply
  33. vamsi:

    Okay..I got it :D
    in
    /etc/lighttpd/lighttpd.conf

    add
    $HTTP[“host”] =~ “(^|\.)YOURDOMAIN\.com$” {
    server.document-root = “/var/www/YOURDOMAIN.com/html”
    }

    :D

    October 19, 2009 @ 2:28 pm | Reply
  34. this setup is good..
    but can you please provide an estimate of how much traffic it can handle ?
    thanks

    November 4, 2009 @ 3:02 am | Reply
  35. picks:

    very nice..
    but I found that Apache will be installed by default in many versions of debian ( I tried in Lenny )..so use this to remove it
    [code]
    apt-get remove apache2
    [/code]

    November 17, 2009 @ 3:26 am | Reply
  36. lain:

    excellent work! I think.

    December 3, 2009 @ 2:00 pm | Reply
  37. Excellent article.

    We ended up purchasing a “LowEndBox Special” from Server Complete earlier today to try this out on (minus the OpenSSH & PDKSH replacements) and sure enough at the end of it lighttpd/PHP/MySQL/exim4/syslog-ng was using just 43 MB of RAM :)

    As the VPS actually comes with 256 MB RAM anyway (270MB with Burst) we still have plenty of RAM left for use with other things – which is always useful.

    December 6, 2009 @ 10:10 pm | Reply
  38. Andrew:

    Hi,

    I think there is an error in your phpinfo screenshot. You create phpinfo.html but then call phpinfo.php.

    You can force html files to be parsed for php code but I don’t think you do (or want to do) that?

    I am I right in thinking this will only work for Xen machines, not OpenVZ?

    December 8, 2009 @ 10:32 pm | Reply
  39. @Andrew — thanks. Updated.

    It should work on OpenVZ as well, although I found Xen is more predictable with memory usage.

    December 8, 2009 @ 10:35 pm | Reply
  40. Andrew:

    Thanks. RAMHost are offering an 80MB RAM OpenVZ for $2.99 pm so I am interested in seeing if I can get WordPress to run – for my education rather than any traffic.

    I’ve never used lighttpd and never heard of Nginx. Are they compatible with Apache e.g. .htaccess entries, rewrite code etc.?

    December 8, 2009 @ 11:05 pm | Reply
  41. IWTFI:

    how can i change all users shells to pdksh?

    December 14, 2009 @ 8:57 pm | Reply
  42. Never tried but this says it’s a simple edit to the /etc/passwd file.

    http://www.linuxforums.org/forum/redhat-fedora-linux-help/114190-change-shell-all-how.html

    Please note that I am *NOT* in a position to test this as I’m time limited today and this coffee shop blocks SSH access.

    December 15, 2009 @ 1:49 pm | Reply
  43. Just to clarify a point which I seem to be missing. Why is using Xen a better solution in this case instead of using something like OpenVM? I understand that we’re talking about Swap memory for Xen instead of burstable member for the others. Just trying to understand why that’s important.

    Thanks,
    -drmike

    December 19, 2009 @ 12:50 am | Reply
  44. Xen’s memory model is just much more predictable, so you do not need hacks such as this one. Google for “Xen vs. OpenVZ” for some articles.

    December 19, 2009 @ 4:20 am | Reply
  45. Thanks for that. I gather that Veportal is in the same boat as OpenVZ when it comes to memory setup?

    December 24, 2009 @ 9:30 pm | Reply
  46. Just caught something on this. If you install WordPress on top of Lighttpd, you;re going to have a problem with the image multiple file uploader as it requires Lighttpd 1.5 and the Debian package is 1.4.x.

    http://redmine.lighttpd.net/issues/1017

    http://core.trac.wordpress.org/browser/trunk/wp-admin/includes/media.php#L1471

    December 28, 2009 @ 6:44 pm | Reply
  47. Nice tutorial! I followed it to make my own VPS using a cheap old 233Mhz server I had kicking around in my cupboard, and set it up following this way (some parts I had to customize).

    I’m using Debian Sarge 3.1 on this server of mine, with thttpd (nginx and lighttpd were unavailable), dropbear, perl, dash and alsa (for a neat little macintosh-inspired startup tune). ntpdate is also being used as the computer doesn’t have a Real Time Clock.

    Total ram usage on a fresh boot is about 12MB of RAM.

    Thanks again for a wonderful tutorial!

    December 29, 2009 @ 4:36 am | Reply
  48. I got a 128MB VPS.

    Following this guide, the memory usage is 41Mb in total(well, almost no traffic at this stage). I am running lighttpd+php5-cgi+sqlite+xcache. For blogging, I am using Dokuwiki and Dotclear(which supports sqlite and wiki syntax).

    I think lighttpd also need some specific optimization for better performance.

    December 29, 2009 @ 5:38 am | Reply
  49. I have been playing with this sort of setup on my vps but I am using nginx over lighttpd as lighttpd has a memory leak in it atm, at my useage its not really noticable but for those on really small vps’s im sure it will be a problem quite fast :)

    December 29, 2009 @ 11:09 am | Reply
  50. There’s a fairly easy walkthrough on installing Nginx here in case you want to go that route:

    http://library.linode.com/web-servers/nginx/php-fastcgi-debian-5-lenny

    Looks good for us so far.

    December 29, 2009 @ 3:23 pm | Reply
  51. for fun, I installed apache onto my vps. When loading a wiki (pmwiki ), cpu usage went through the roof and memory shot up. I had tweaked Apache for low memory use. Installed thttpd again, and all is well.

    Apache is not memory efficent. Full stop.

    December 30, 2009 @ 12:42 am | Reply
  52. This is great tutorial i’ve seen.
    What about want to have joomla instead of wordpress?
    Any guide or tutorial for having great vps server for joomla environment?
    Is there any specific requirements to have joomla website server?
    The ideal how many joomla website to get best performance in vps?
    Any advice wud be appreciate.

    Thank you

    January 14, 2010 @ 11:49 am | Reply
  53. Hi,
    This is great tutorial i’ve seen.
    How about wanna having vps for joomla website environment instead of wordpress? There is any special requirements or configuration like VPS for WordPress as above tutorial?
    Will you writing about VPS for Joomla Environment? Any advice would be appreciate.

    Thanks.

    January 14, 2010 @ 8:00 pm | Reply
  54. Thanks! I’m now running my wordpress site of 64MB with Debian 64bit over at Tiny VPS. Works a real treat :).

    February 1, 2010 @ 6:17 pm | Reply
  55. Eric:

    Thanks for this guide!

    I have lighttpd, mysql, php5, awstats, and mybb running at around 43MB. =) I’m not on a 64MB server, but still!

    February 22, 2010 @ 8:41 pm | Reply
  56. Grekl:

    Well…

    I can’t have MYSQL working @ tinyVPS… Sam Parkinson – how did you manage?

    Even with the my.cnf giver here, mysql doesn’t want to start and the logs are… totally empty!

    I’m lost and don’t know what to do… Well, I’m on debian 32bits – heard that 32 was dealing better with low memory systems – maybe switching to debian 64 would do the trick?

    But still – it’s strange, i really don’t see why I can’t have mysql working..

    February 23, 2010 @ 1:37 pm | Reply
  57. Sandro:

    Do you know a light way to monitor all those sites in bandwidth usage with lighttpd?

    I would use some CP with Apache, but no CP supports this webserver, and with that ram it’s just stupid using one:D

    March 6, 2010 @ 6:56 pm | Reply
  58. @Sandro – Have a look at vnStat, and it’s php frontend. It works a treat on lighttpd.

    http://www.sqweek.com/sqweek/index.php?p=1

    March 8, 2010 @ 1:26 pm | Reply
  59. Terry:

    A great article – running a couple of WordPress blogs on a 128MB Xen VPS without hassle. However – I notice that despite using the same fastCGI config, I end up with 4 fastCGI processes rather than 2, one of which consumes about 40mb of my RAM… =S

    May 15, 2010 @ 5:02 pm | Reply
  60. what a nice trick!
    good job :)

    May 20, 2010 @ 10:03 am | Reply
  61. earl:

    This guy Steve Hanov has an interesting site.. I think his whole site is hosted on a home dsl connection on his acer aspire one netbook. He also created his own blogging system with 1907 lines of PHP. you can check it out.

    http://stevehanov.ca/blog/index.php?id=71

    May 29, 2010 @ 7:28 pm | Reply
  62. earl:

    This one leads to his blogging system.

    http://stevehanov.ca/blog/index.php?id=49

    May 29, 2010 @ 7:30 pm | Reply
  63. Ron:

    Hi can you please post an article like this in setting up a vps using nginx as web server. thanks

    May 30, 2010 @ 6:52 am | Reply
  64. @earl — 512MB + a full Atom for yourself is too much for a low end box :)

    @Ron — there plenty of Nginx articles on line. I am pretty much using Nginx exclusively these days. Maybe I’ll share my setup some day.

    May 30, 2010 @ 9:57 am | Reply
  65. @admin I’ll be looking forward for that setup. Actually i’ve built my first website few weeks ago just to learn web development. It is written in Python/Django and is hosted on webfaction. Webfaction provides an out of the box setup to host a django site and other cms, however at 80MB shared 1 plan, price $9.50/month, i can be more productive if i host my site on a vps and learn the ropes of system administration.

    May 31, 2010 @ 1:50 am | Reply
  66. Thanks again, worked perfectly with a test site !

    June 10, 2010 @ 2:22 pm | Reply
  67. innya:

    I am also interested in Nginx server and I found the article on how to setup Nginx webserver.

    http://www.cyberciti.biz/faq/rhel-fedora-install-configure-nginx-php5/

    I did follow up and try to setup on my Centos 64 bits 256mb vps. It is up and running.

    June 11, 2010 @ 6:22 am | Reply
  68. Paulmankipu:

    WordPress 3.0 is out ! I’m excited !

    June 18, 2010 @ 5:33 pm | Reply
  69. Raj:

    This is a nice article about low memory/low disk space VPS servers. The one thing that is not mentioned here is CPU. There are VPS providers out there that limit CPU down to a few hundred Mhz as well as low mem/low disk. How much processing power would you need to serve up 18 static sites reasonably well? For that matter, how much processing power would you need to serve up the WP blogs reasonably well?

    July 17, 2010 @ 11:01 pm | Reply
  70. @Raj — define “reasonably well”.

    For static sites, for event based web servers it’s mostly limited by IO. For a WordPress blog, this very site runs on a Xen VPS with 80MB of memory. Fast enough for me.

    July 18, 2010 @ 1:49 pm | Reply
  71. Raj:

    Most sites, on today’s high speed home internet connections, can load within a few seconds (2 or 3 seconds from the time your browsner initiates the request until the time the page is fully rendered). Would you agree?

    So I would think “reasonably well”, for an 18 static site server, would be to have the sites load within that timeframe even when the server is processing a few concurrent requests for the static content.

    July 18, 2010 @ 5:54 pm | Reply
  72. Gotta admit this this is one of the few sites I’ve never had a problem with slow loads or not loading at all.

    July 18, 2010 @ 10:16 pm | Reply
  73. @Raj — you’ll find that with static site, the speed is usually determined by

    • Number of Javascripts (and in some extend, CSS and images) on the page
    • Size of the page
    • Network bandwidth/throughput/latency between the server and the user
    • IO performance of the server, if it is not already cached in the memory

    And usually has not much to do with the CPU.

    July 18, 2010 @ 11:37 pm | Reply
  74. When I run the command to configure PHP and lighttpd

    cat > /etc/lighttpd/conf-enabled/10-cgi-php.conf
    server.modules += (“mod_cgi”)
    cgi.assign = (“.php” => “/usr/bin/php5-cgi”)^D

    My SSH session just hangs.

    July 24, 2010 @ 4:01 pm | Reply
  75. IWTFI:

    @Jackk just run “lighttpd-enable-mod fastcgi” and then restart lighttpd.

    July 24, 2010 @ 4:04 pm | Reply
  76. @IWTFI – Thanks – that worked! xD

    July 24, 2010 @ 4:09 pm | Reply
  77. IWTFI:

    yes that’s working and is easier. can’t understand why LowEndAdmin did not choose this method.

    July 24, 2010 @ 4:13 pm | Reply
  78. Perhaps there should be a mention of the command you posted in case this doesn’t work for others?

    July 24, 2010 @ 4:15 pm | Reply
  79. IWTFI:

    the commands in the post does nothing.

    July 24, 2010 @ 4:22 pm | Reply
  80. IWTFI:

    actually he means to open /etc/lighttpd/conf-enabled/10-cgi-php.conf and write:
    server.modules += (“mod_cgi”)
    cgi.assign = (“.php” => “/usr/bin/php5-cgi”)

    but why not just enable fastcgi? more memory usage?

    July 24, 2010 @ 4:30 pm | Reply
  81. Which method uses more RAM?

    July 24, 2010 @ 4:32 pm | Reply
  82. IWTFI:

    lighttpd-enable-mod fastcgi

    but if you just want cgi open /etc/lighttpd/conf-enabled/10-cgi-php.conf write:
    server.modules += (“mod_cgi”)
    cgi.assign = (“.php” => “/usr/bin/php5-cgi”)

    then disable fastcgi “lighttpd-disable-mod fastcgi” and restart lighttpd

    July 24, 2010 @ 4:35 pm | Reply
  83. IWTFI:

    but well….. fastcgi is faster xd

    July 24, 2010 @ 4:37 pm | Reply
  84. @Above

    Is there much difference between how much RAM each method uses?

    Jack.

    July 24, 2010 @ 4:39 pm | Reply
  85. IWTFI:

    yes. fastcgi uses way more RAM.

    July 24, 2010 @ 4:40 pm | Reply
  86. Thanks your help. I think I will stick with just CGI.

    Jack.

    July 24, 2010 @ 4:41 pm | Reply
  87. IWTFI:

    yes that’s what i suggest actually ;)

    July 24, 2010 @ 4:42 pm | Reply
  88. Thanks for all your help!

    Jack xD

    July 24, 2010 @ 4:42 pm | Reply
  89. Sorry to be a pain – Why does this happen?

    vps:~# /etc/init.d/lighttpd force-reload
    Stopping web server: lighttpd.
    Starting web server: lighttpd2010-07-24 21:12:45: (configfile.c.796) source: /etc/lighttpd/conf-enabled/10-cgi-php.conf line: 2 pos: 41 invalid character in variable name
    2010-07-24 21:12:45: (configfile.c.852) configfile parser failed at: )
    2010-07-24 21:12:45: (configfile.c.855) source: /usr/share/lighttpd/include-conf-enabled.pl line: 2 pos: 8 parser failed somehow near here: (EOL)
    2010-07-24 21:12:45: (configfile.c.855) source: /etc/lighttpd/lighttpd.conf line: 158 pos: 1 parser failed somehow near here: (EOL)
    failed!
    vps:~#

    July 24, 2010 @ 5:13 pm | Reply
  90. IWTFI:

    i’m not sure but i think you enabled both fastcgi and cgi together :/

    try “lighttpd-disable-mod fastcgi”.

    July 24, 2010 @ 5:26 pm | Reply
  91. vps:~# lighttpd-disable-mod fastcgi
    Available modules: auth cgi fastcgi proxy rrdtool simple-vhost ssi ssl status userdir
    Already enabled modules: cgi-php simple-vhost
    Already disabled fastcgi
    Run /etc/init.d/lighttpd force-reload to enable changes
    vps:~#

    Looks as if it’s already disabled.

    July 24, 2010 @ 5:29 pm | Reply
  92. IWTFI:

    i’m sorry i can’t help. what about rebuild your vps and setup all again in a clear installation?

    July 24, 2010 @ 5:30 pm | Reply
  93. OK I’ll try a rebuild and get back to you.

    Thanks,
    Jack.

    July 24, 2010 @ 5:31 pm | Reply
  94. I try the tutorial on my VPS with Debian 5,
    But I got a problem when I try to make the database :
    # mysqladmin -uroot -proot create test_blog
    mysqladmin: connect to server at ‘localhost’ failed
    error: ‘Access denied for user ‘root’@’localhost’ (using password: YES)’

    Would anyone help me with this issue?
    :(

    July 25, 2010 @ 8:59 am | Reply
  95. David:

    Erawan: Where it says “-proot” use your mysql root password after the “-p” (instead of root).

    If you haven’t set a mysql root password yet, try this to set it:
    mysqladmin -u root password ‘yourpassword’

    (replace ‘yourpassword’)

    July 25, 2010 @ 9:21 am | Reply
  96. @Erawan Arif Nugroho – Did you follow the tut to lower your MySQL RAM usage?

    Jack.

    July 25, 2010 @ 9:22 am | Reply
  97. @Mr. David : Thank you for the explanation, I will try it again now. :)
    @Mr. Jack : Not yet sir, I just learn this tutorial, not yet with another tutorial. Maybe after finished with this, I will try it.

    July 25, 2010 @ 9:42 am | Reply
  98. Thanks for this insightful post, but don’t you run BIND on your 64MB servers ?

    July 25, 2010 @ 9:43 am | Reply
  99. I am done setting up the VPS as the tutorial.
    Its running on 34Mb with the Santrex OpenVZ VPS.

    My last problem is, setting it wether using www or without www, it still the same content. And also when the visitor goes to the VPS IP, it shows the same content.

    July 25, 2010 @ 12:53 pm | Reply
  100. lcant believe u doit :( I m tring to run my 50K hit site on a 24gb ram with 8 quad cores…

    August 29, 2010 @ 4:16 pm | Reply
  101. I would like to ask everyone.

    Just like the LEA in this blog, he is using an email contact @ leb.com

    How we setting up the email for handling all incoming email?

    Would someone explain it to me please?

    September 5, 2010 @ 8:23 am | Reply
  102. Tom:

    See google apps http://www.google.com/apps/intl/en/group/index.html, you just change mx records with your dns provider and you got yourself a gmail + you domain ;)

    September 5, 2010 @ 12:25 pm | Reply
  103. @Tom

    I am already did it, and it works :)
    But that if I am using the Cpanel, It was so easy.

    Then the problem is, when I am using a Debian VPS, and running this LEB tutorial.
    I have no clue where do I have to edit the MX

    Or,the only thing I have to do is at the Domain Registrar?

    September 5, 2010 @ 12:31 pm | Reply
  104. @Erawan — you either host the DNS yourself (get 2 cheap VPS for redundancy) or use a 3rd party DNS. There are many free ones as well as paid ones (I use DNSMadeEasy myself). Many registrar also comes with free DNS hosting for domain purchases.

    September 5, 2010 @ 1:14 pm | Reply
  105. @LEA :

    Im not understand about the DNS, or atleast if not using any control panel( WHM or Plesk).
    In one of my VPS ( http://www.noenoey.com), I am just running a Debian, and folloed the tutorial in this thread.

    I just pointing my Name Server setting in the Domain Registrar ( NameCheap ) to the IP of my VPS.
    And in the NameCheap, there are several options. For examples :
    – name server registration
    – domain name server setup ( using the ip registered in name server registration)
    – all host record ( using CNAME, A, URL, NS Record)
    – and an option for the Mail : (Automatically set MX records necessary for Google Apps Email, [MX records will be set after you click Save Changes button])

    So, that is the one makes me confuse.

    If in case, I am running a WHM/Cpanel ( http://www.erawanarifnugroho.com), I can easily change the MX in the Cpanel, and change it to GoogleApps.And it’s works.

    But if Im working in the Debian VPS, I don’t know where to start

    Should I change the MX in the NameCheap? or in the VPS?

    September 5, 2010 @ 1:27 pm | Reply
  106. id:

    @erawan,

    in this tutorial, DNS server is not configured. if you want something simple, just use DNS provided by namecheap (it’s either V1 or V2 i guess). Use that one to point your MX records to the ones that Google Apps use. And point A record to your vps ip address.

    in case you insist to use your vps as dns server and point your NS to vps ip, you should install and configure by yourself (which is not covered in this tutorial).

    the dns server you set in WHM/Cpanel is basically the same like DNS provided by namecheap or DNS you configure by yourself.

    i hope this will make you confused clear :)

    September 5, 2010 @ 2:32 pm | Reply
  107. @id

    Thank you for the explanation :)
    I will try it.

    For the striked word “confused”, well, it does makes me confused.
    But this is also teach me another good thing.
    I learn new thing every day, and I am happy with it. :D

    Thank you

    September 5, 2010 @ 2:54 pm | Reply
  108. Gene:

    Hello Author,

    For weeks I been searching for a VPS tutorial that will launch my very first “Hello World” html file.
    Now, I found this and I am so happy tonight that I was able to follow your simple steps and with the help of my VPS provider (www.hostmist.com). I love you so much guys for helping the super newbie like me with zero knowledge in bash commands. Having “Hello World” is such an accomplishment for me tonight. My one month baby subscription with my host gives me fulfillment and encouragement to learn unmanaged VPS.

    I pray that you and my current host to be more bless and have shower of blessing. Thank you for being kind for sharing your knowledge with out anything in return.

    God Bless and More Power!

    Gene

    September 14, 2010 @ 7:12 pm | Reply
  109. jsut curios if someoen cares to make this into a script just like the one for nginx? http://www.lowendbox.com/blog/wordpress-cheap-vps-lowendscript/
    I’d also be interested in a comparison between this solution and the one I linked above which uses nginx.

    Otherwise great info ehre, thanks!

    October 31, 2010 @ 12:14 pm | Reply
  110. Great article, never gets old to try this stuff. I too prefer Xen over OpenVZ, but I think folks will find more offerings for OpenVZ so instead of your comment “It should work in OpenVZ”, I spent about an hour and have it working great in OpenVZ consuming 30mb of ram idle. I configured the VPS with 64mb of guaranteed ram and an 80MB burst. 1st try was with no burst, but saw a few errors that were memory related crop up.

    # free
                 total       used       free     shared    buffers     cached
    Mem:         81920      31632      50288          0          0          0
    -/+ buffers/cache:      31632      50288
    Swap:            0          0          0
    
    December 9, 2010 @ 4:45 am | Reply
  111. Sonic:

    Hi LEA, thanks for great tut! I follow your tut and my site running quite nice. But now, my script require php 5.3, can you let me know how to upgrade php to 5.3 :D

    January 24, 2011 @ 3:19 am | Reply
    • Personally I will use whatever the distro provides so I get up to date security updates. Just use Ubuntu 10.04/10.10 or Debian 6 Squeeze to get PHP 5.3.

      January 24, 2011 @ 2:20 pm | Reply
  112. Very helpful article for anyone wanting to set up a LEB. Used this as a template for my boxes.I guess there should be more of such posts ..

    January 31, 2011 @ 3:32 am | Reply
  113. John:

    Simply awesome tutorial! This is exactly what every low end n00b needs. I really hope that you will eventually port this tutorial to cover nginex. I love your nginex stack, but I really wish there was a good tutorial like this that covered everything in depth. Thanks for this anyway. :D

    February 5, 2011 @ 2:34 am | Reply
  114. Steve R.:

    Thank you LEA, you taught me a lot of useful tips. Even if I have a 256MB/512MB(burst) VPS I followed parts of your tutorial and it got faster.

    February 18, 2011 @ 9:05 pm | Reply
  115. Believe it or not, it’s still possible to run a forum on a 64MB VPS even with MySQL 5.1, PHP 5.3.5 and nginx 8.53 running on CentOS 5.5. I did not change the syslog daemon or switch to running dropbear for ssh and here is the RAM use on a 64MB VMWare Fusion “VPS” running on my laptop:
    total used free shared buffers cached
    Mem: 59 57 1 0 1 16
    -/+ buffers/cache: 39 19
    Swap: 2047 0 2047
    39 MB used, and there is 2 PHP processes running under PHP-FPM.

    February 22, 2011 @ 6:02 am | Reply
  116. John_R:

    Can you recommend a light-weight web interface ala Webmin for handling nginx vhosts?

    May 6, 2011 @ 3:15 pm | Reply
  117. Alex:

    Nice tutorial managed to get it to 29mb

    USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root         1  0.0  0.2   1984   684 ?        Ss   03:22   0:00 init [2]
    daemon    1284  0.0  0.1   1768   508 ?        Ss   03:22   0:00 /sbin/portmap
    root      1382  0.0  0.1   1708   508 ?        S    03:22   0:00 /bin/sh /usr/bin/mysqld_safe
    mysql     1419  0.0  2.2  28240  5852 ?        Sl   03:22   0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld
    root      1420  0.0  0.2   1632   540 ?        S    03:22   0:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
    root      1468  0.0  0.1   2044   468 ?        Ss   03:22   0:00 /usr/sbin/dropbear -d /etc/dropbear/dropbear_dss_host_key -r /etc/dropbear/dropbear_rsa_host_key -p 22
    103       1746  0.0  0.3   6136   892 ?        Ss   03:22   0:00 /usr/sbin/exim4 -bd -q30m
    www-data  1767  0.0  0.6   5848  1780 ?        S    03:22   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
    root      1771  0.0  0.2   3272   564 ?        Ss   03:22   0:00 /usr/sbin/famd -T 0
    root      1786  0.0  0.3   2040   872 ?        Ss   03:22   0:00 /usr/sbin/cron
    root      1800  0.0  0.4   2356  1244 ?        Rs   03:22   0:00 /usr/sbin/dropbear -d /etc/dropbear/dropbear_dss_host_key -r /etc/dropbear/dropbear_rsa_host_key -p 22
    root      1802  0.0  0.2   1804   584 pts/0    Ss   03:23   0:00 -pdksh
    root      1817  0.0  0.3   2300   896 pts/0    R+   03:30   0:00 ps aux
    
    May 29, 2011 @ 3:31 am | Reply
  118. I’ll second thttpd for static files – has basic vhost support and can even run php in extreme cases.

    Instead of wordpress, use flatpress – almost the same but without database – uses files. On another thought – don’t even use *press and go with jekyll (powers github’s pages) – it’s static page generator. This should lower your memory footprint even more.

    All in all great article, nice ones with dash and dropbear, didn’t know about them.

    Damir

    June 11, 2011 @ 6:59 pm | Reply
  119. miguel:

    Nice article!
    Could you point me to a lean Debian image like yours that I could download? Or instructions on how to strip down Debian to bare basics for a web server configuration?

    I’ve tried install a server Debian from debian.org, but I don’t know which packages to uninstall and I feel like I always uninstalling system packages I shouldn’t.

    -miguel

    June 12, 2011 @ 4:15 pm | Reply
    • John_R:

      For barebones Debian installs, use the “netinst” image.

      Install the absolute basic system with openssh-server and then install additional services as needed.

      You may be able to use Webmin as a control panel.

      June 12, 2011 @ 11:26 pm | Reply
  120. Dave Frandin:

    With all the talk about vps’s, I thought I might fill you guys in a vps vendor I found a few months ago. I had been with fsckvps for about a year, and was paying $10/mo for a 512mb/1024burst OpenVZ vps. Compared to just about every other vendor’s 512mb offerings, this was a steal!.. Most 512mb openvz/xen vps I found were closer to $30/mo.. Then I happened upon thrustvps.com.. Their 512mb OpenVZ offering, with essentially the same diskspace/transfer as fsckvps was $6/mo!! They also offer a 512mb Xen/Windows2008 offering for those who are Linux-averse.. I’ve since moved my 3 vps over to them.. Great support! Needed the tun interface enabled for OpenVPN, I barely got the ticket in and got an email saying its done.. I don’t work for them, have any stock in them, nor even on their affiliate program, I just think they are a VERY good deal!

    June 12, 2011 @ 10:27 pm | Reply
  121. naugtur:

    No idea if anyone reads my comment, but there’s a lot to do to take mem optimization to the limit.

    For those, who want something extreme I suggest BOA webserver. It serves files and runs CGI. I am using it on embedded devices and it’s easy to use. You won’t set up a wordpress on it (at least not easily) but it can run as a single process and serve your html as fast as hdd and network lets you and it uses virtually no ram (less than 2MB)

    June 13, 2011 @ 2:18 pm | Reply
    • well, you could use uHTTPd from the OpenWRT project then as well. It features equally low mem(I use it on an 8MB RAM embedded board, along with a couple of other websites and it _DOES_ allow CGI / PHP, so WordPress is possible(tested on my 8MB Board)

      June 13, 2011 @ 10:38 pm | Reply
  122. kode89:

    Hi, I followed the instructions to install syslog-ng however my installation seems to be using more memory than the one in this tutorial. Here is what I get:

    root@normandy:~# ps -C syslog-ng v
      PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
    18148 ?        S      0:00      0   298 42925   732  0.0 supervising syslog-ng
    18149 ?        Ss     0:00      1   298 53533  2704  0.3 /usr/sbin/syslog-ng -p /var/ru
    

    Mine seems to be running at 2.7mb rss. Has anyone else experienced this?

    July 18, 2011 @ 6:57 am | Reply
  123. Does anyone know how to configure MySql to use up the memory space left to increase the performance?

    August 18, 2011 @ 12:25 am | Reply
    • Increase the values for query cache, table cache, etc in my.cnf

      August 18, 2011 @ 2:25 am | Reply
  124. Thanks, Yomero,
    a number of caches and buffers in there, that’s why I was asking, :)

    August 18, 2011 @ 2:30 am | Reply
    • If you mean that you want specific values, I don’t know, try yourself and see how much memory MySQL uses.

      August 18, 2011 @ 3:01 am | Reply
  125. On Debian 6 Squeeze, you need to remove the

    skip-bdb

    line for MySQL to work.

    December 17, 2011 @ 8:18 am | Reply
  126. Pats:

    @LowEndAdmin – I have followed most of the steps, havent yet installed WordPress. I want to use Nginx.
    Can you tell if its ok to do “apt-get remove lighttpd” and install Nginx using the links mentioned by some members above. or Do i need to remove php, mysql etc. and install them again after installing Nginx (so they can auto-configure)
    Thanks

    March 2, 2012 @ 1:30 pm | Reply
    • Pats:

      ok i –purge removed and followed bash setup-debian.sh path..

      March 3, 2012 @ 8:09 am | Reply
  127. For people want to disable innodb in MySQL 5.5 http://sshd.info/2012/03/14/disable-innodb-in-mysql-5-5-x/

    March 19, 2012 @ 12:02 pm | Reply
  128. Danny SMc:

    I am trying to make a static website, and I have a RPi box, I have installed Lighttpd on to the box and have installed mysql and php files so now it should be able to run, but when I want to try it out i cant because i dont know what my rpi address, I did it off a site and it said: to test its: http://[your raspberry pi address]/index.lighttpd.html But i don’t know my raspberry pi address…I have searched for it and gone on about 30 different forums and nothing explains :/ could you help?

    August 2, 2012 @ 8:17 am | Reply
    • John_R:

      Log into your RPi box and run ifconfig, look for your IP address.

      ?

      August 20, 2012 @ 8:58 pm | Reply
  129. John_R:

    This worked under Debian 6 32-bit, with one small problem.

    Lighttpd with simple_mod_vhost looks for the vhosts in /srv/YOURDOMIN.COM/htdocs

    It does not look in /var/www at all.

    You should make the appropriate changes in /etc/lighttpd/conf-enabled/10-simple-vhost.conf

    ‘srv’ becomes ‘www’ and ‘htdocs’ becomes ‘html’.

    I have 7 static subdomain sites set up as a test, and it uses a whopping 20 megs of RAM.

    Great work with the simple guide!

    August 18, 2012 @ 7:46 pm | Reply
    • John_R:

      Went ahead and added Webmin, still uses less than 35 megs idle, jumps up to around 55 when I load update the package list through Webmin.

      That is fantastic!

      August 18, 2012 @ 7:58 pm | Reply
      • John_R:

        If you want a flat-file wordpress-type script, check out FlatPress.

        Not only does it use NO mysql, there is also a remote posting plugin so you can post from your phone :D

        You do have to install php though.

        August 25, 2012 @ 1:18 pm | Reply
  130. John_R:

    O.k., big kids.

    Got the flatpress script lined out. I am running 20 blogs in 64 megs.

    Only problem is the maintainer of Flatpress.

    Contacted them about making a “latest.tar.gz” file on their website for distribution, but haven’t heard back.

    Maybe all of you can request it as well.

    September 2, 2012 @ 9:29 pm | Reply
  131. mark:

    Good stuff!

    February 19, 2013 @ 5:11 am | Reply
  132. GBolt:

    This is really amazing, and it’s so detailed I can’t go wrong even if I tried. Thanks a lot!

    February 23, 2013 @ 5:05 pm | Reply
  133. Maximilian:

    Working but…
    less than 128MB could couse problems 503 Errors or PHP Mysql Errors.
    Better are 128MB + Swap that can handle much more requests

    March 17, 2013 @ 2:14 am | Reply
  134. Andrew:

    Dear Maik,

    I have a WordPress video site and has the below data:
    Disk usage 35GB
    June projected monthly bandwidth 5TB (it doubles every month)
    Average daily visits 600
    Average pageviews 2,700

    At the end of this year, my projections are that my site disk usage will be 200GB and my bandwidth 50TB. In two years time possibly both will double.

    I found Dreamhost VPS that has unlimited disk usage and bandwidth. The only options to choose is the RAM per month I can buy. $15 for 300MB, $30 for 600MB, $50 for 1,000MB, $100 for 2,000 and $200 for 4,000MB.

    Would my site run on 300MB RAM?

    Thank you in advance for your kind assistance.

    June 25, 2013 @ 9:14 am | Reply
  135. Excellent article. I will be going through some of these issues as
    well..

    July 3, 2013 @ 4:13 pm | Reply
  136. Hi there! I just wanted to ask if you ever have any
    trouble with hackers? My last blog (wordpress) was hacked
    and I ended up losing months of hard work due to no data backup.
    Do you have any solutions to prevent hackers?

    July 8, 2013 @ 4:02 pm | Reply
    • John:

      I dont think this question is very relevant in this context. But some things. First of all, have backups think about how much data you can miss (like one day?) and set the backup schedule to that + check your backups often, setup a site using only your backups and see if it got everything you need to start over. Second keep your WP up-to-date, always. Disable access to /administrator, throw in a .htaccess with a password, or just a deny-all, and remove it when you need to edit something. Dont use FTP, but sftp (ssh) to upload stuff, SSL so you dont sent your passwords unencrypted, and a firewall that only has your ssh port and port 80/443 open…

      July 29, 2013 @ 7:45 pm | Reply
  137. brian:

    hello sir,, i see symbol like this ^D on :

    endor:~# cat > /etc/lighttpd/conf-enabled/10-cgi-php.conf
    server.modules += (“mod_cgi”)
    cgi.assign = (“.php” => “/usr/bin/php5-cgi”)^D

    what buttons i have to press??

    August 24, 2013 @ 12:29 pm | Reply
  138. Howdy! This is my first comment here so I just wanted to give a
    quick shout out and say I genuinely enjoy reading through your posts.
    Can you recommend any other blogs/websites/forums that cover the
    same subjects? Thanks!

    September 4, 2013 @ 2:26 pm | Reply
  139. Wonderful tutorial. I was searching for it

    September 22, 2013 @ 2:05 am | Reply
  140. Hi there, I enjoy reading through your post.
    I wanted to write a little comment to support you.

    Here is my web site … led panel

    September 27, 2013 @ 11:45 am | Reply
  141. You don’t have to be a business owner to take advantage
    of this deduction. So, it is a good idea to go online for selecting a proficient legal representative.
    A IRS Attorney needs to be talented to resolve one’s tax issues
    with one best possible outcome.

    October 13, 2013 @ 12:42 am | Reply
  142. Hello
    I plan to host a simple wordpress, ftp, torrent and the most important a tor client on a hacked router running OpenWRT Linux. The router is D-Link DIR-825 and its hardware is consisted of:
    – 680MHz MIPS cpu
    – 64MB RAM
    – 8MB Internal Flash
    – 1*USB (I prefer to make root and swap partitions on the external USB flash drive and boot from that too)
    This router can be hacked to run OpenWRT, however I want to know is it possible to also run a tor client and a simple webserver (for wordpress) in OpenWRT linux on such a weak hardware?

    Waiting for your exciting response. (Please also email your response comment to me too, I fear to lose your answer!)

    November 22, 2013 @ 3:49 pm | Reply
    • BastetFurry:

      You can run almost anything on that thing, it might just be slow.

      April 5, 2014 @ 5:32 pm | Reply
  143. I was really bored, so I translated this article to indonesian and posted it to my blog!
    I put backlink anyway. Nice article though.

    http://itsrinaldo.net/2013/12/30/ya-kamu-bisa-menjalankan-18-website-statis-di-dalam-vps-64mb/

    December 30, 2013 @ 10:42 am | Reply
  144. Everyone loves what you guys tend to be up too.
    This sort of clever work and coverage! Keep up the awesome works guys I’ve
    included you guys to my own blogroll.

    March 23, 2014 @ 2:44 am | Reply
  145. ide yang bagus… (Y)
    debian emang bagus untuk server ram kecil..
    namun saya sarankan web server menggunakan nginx

    April 16, 2014 @ 6:43 am | Reply
  146. Nice blog right here! Additionally your website
    so much up fast! What web host are you the
    usage of? Can I am getting your affiliate hyperlink for your host?
    I wish my website loaded up as quickly as yours lol

    September 6, 2014 @ 2:47 am | Reply
  147. lol, When I thought this article was a joke. You could probably setup a site with 64 mb but it wont function normaly.

    November 3, 2014 @ 7:34 am | Reply
  148. fix:

    apt-get install syslog-ng && dpkg –purge rsyslog

    This is not very good on Debian 7:

    The following NEW packages will be installed:
    cron exim4 exim4-base exim4-config exim4-daemon-light libcap2 libdbi1 libevtlog0 libmongo-client0 libnet1 libsyslog-ng-3.3.5 libsystemd-daemon0 logrotate syslog-ng
    syslog-ng-core syslog-ng-mod-json syslog-ng-mod-mongodb syslog-ng-mod-sql

    December 22, 2014 @ 4:55 pm | Reply
  149. I have learned lot of things from it on the topic of blogging. thanks.BDWEBIT.COM

    December 28, 2014 @ 7:14 pm | Reply
  150. This Nuts:

    Damn! 2016 and this still very usefull!

    Tnx

    March 18, 2016 @ 2:38 pm | Reply
    • dutchie:

      Hell Yeah! I will keep this bookmark forever!

      May 1, 2016 @ 12:12 pm | Reply
      • Finally I am Sure that I can Deploy nearly 20-30 Sites on 512 MB Digital Ocean Droplet configuring centminmod or easyengine on my vps

        May 9, 2016 @ 7:16 am | Reply
  151. 18 websites with 64 MB memory ? I’m getting a hard time with memory consumption in a 512MB VPS with two WordPress sites.

    July 11, 2016 @ 8:37 am | Reply
  152. Julián:

    Is the any chance to get this guide updated? For Linode?

    March 8, 2018 @ 2:13 pm | Reply
  153. Songwut K.:

    How about NodeJS ?

    July 7, 2019 @ 12:14 pm | Reply
  154. Pingback: Whatever Happened to LEAdmin? - LowEndBox

  155. Pingback: v6Node: VMs start at 4.5€ /year in Germany! - LowEndBox

Leave a Reply to Damir Cancel reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *