Tutorials

Bootstraping WordPress/Nginx/PHP/MySQL on a Cheap VPS with lowendscript

One constantly posted question on LowEndBox and LowEndTalk is — how to get the same setup as LowEndBox, a WordPress site that runs on cheap VPS with 80MB of memory? Instead of doing a step-by-step explanation (damn I hate writing long blog posts), I decided to wrap it into a bash script that does it all.

NginxPHP
WordPressMySQL

It is based on my previous script here, and it has been tested on both Debian 5 “Lenny” and Ubuntu 10.04 “Lucid Lynx”. Sorry no other distributions are supported. It is currently hosted at github so feel free to branch it and tune it to your heart’s desire.

Usage

Here is a quick step by step on how to set up a WordPress blog running on Nginx, PHP/FastCGI and MySQL on a low end box. Let’s assume that you are going to set up a blog on hostname “blog.example.com“.

  1. Go and buy a cheap VPS. Yes, you know where to find cheap virtual servers under $7/month, don’t you? 🙂 I am using my 6 pound/year RackVM VPS with 128MB memory to test this script, and the performance turns out to be quite good. YMMV.

    Make sure it is either a Debian or a Ubuntu distro though.

  2. After gaining root access to your VPS,
    # wget --no-check-certificate https://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
    ...
    # bash setup-debian.sh system
    ...
    # bash setup-debian.sh exim4
    ...
    # bash setup-debian.sh nginx
    ...
    # bash setup-debian.sh mysql
    ...
    # bash setup-debian.sh php
    ...
    # bash setup-debian.sh wordpress blog.example.com
    ...
    
  3. Now altering your DNS entry to point blog.example.com to your new VPS (or alter your local /etc/hosts entry). Navigate to it from your browser, and you should be presented with WordPress set up page. Fill in your blog’s name, admin’s password and contact email, and your new WordPress is online!

    Just repeat the last step (running bash setup-debian.sh wordpress <hostname>) to set up more blogs on the same box.

That’s it!

Software Stack

It’s pretty similar to my own stack that runs LowEndBox.com.

  • dropbear to replace openssh. Invoked from xinetd.
  • inetutils-syslogd to replace rsyslog.
  • exim4 to replace sendmail (if installed). Re-configured to allow Internet delivery.
  • cron
  • nginx
  • mysql. Re-configured to remove innodb support, remove query cache and reduce key buffer size.
  • php with built-in FastCGI interface. Running only 1 child process and respawn after 5,000 requests.

The lowendscript is also

  • Removing some commonly bundled applications that should not be there in the first place for a minimal distro (apache2, sendmail, bind9, samba, nscd, etc).
  • MySQL root is given a new password (which can be found in ~root/.my.cnf)
  • Installing each WordPress site under /var/www/<hostname>. It will create appropriate database, users and password for the site.

I have to say that it is still “work in progress”, but if you want to figure out the internals please check the source code of that bash script.

Memory Usage

I am testing the same script on the following 3 systems:

  • Ubuntu 10.04 64bit (RackVM)
  • Debian 5 64bit (RackVM)
  • Debian 5 32bit (VPSGuy)

They are all showing different memory usage. I am taking the snapshot of memory usage AFTER 10 page loads on the WordPress blog that has been created to ensure PHP process is fully loaded.

Ubuntu 10.04 64bit

root@ubuntu64:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.5  23300  1536 ?        Ss   06:58   0:00 init
root     10124  0.0  0.5  23576  1496 ?        Ss   07:34   0:00 dropbear -i
root     15742  0.0  0.7  17880  1944 pts/0    Ss   07:35   0:00 -bash
root     15754  0.0  0.4  14960  1084 pts/0    R+   07:35   0:00 ps aux
root     24290  0.0  0.3  12508   788 ?        S    07:22   0:00 /usr/sbin/syslo
root     24524  0.0  0.3  21064  1004 ?        Ss   07:22   0:00 cron
root     25689  0.0  0.3  19512   972 ?        Ss   07:22   0:00 /usr/sbin/xinet
mysql    26346  0.0  4.2  61812 11248 ?        Ssl  07:23   0:00 /usr/sbin/mysql
www-data 27920  0.0  2.6  87768  7048 ?        Ss   07:23   0:00 /usr/bin/php-cg
www-data 27922  0.5 15.0 122460 39432 ?        S    07:23   0:04 /usr/bin/php-cg
103      30162  0.0  0.3  44356  1000 ?        Ss   07:24   0:00 /usr/sbin/exim4
root     30267  0.0  0.3  28104   932 ?        Ss   07:24   0:00 nginx: master p
www-data 30268  0.0  0.8  28744  2196 ?        S    07:24   0:00 nginx: worker p

root@ubuntu64:~# free
             total       used       free     shared    buffers     cached
Mem:        262144     100500     161644          0          0          0
-/+ buffers/cache:     100500     161644
Swap:            0          0          0

Memory Usage: 98.1MB

Debian 5 64bit

debian64:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.2  10304   740 ?        Ss   12:22   0:00 init [2]
106       1414  0.0  0.3  42708  1004 ?        Ss   12:26   0:00 /usr/sbin/exim4
www-data  1655  0.0  2.5  72028  6560 ?        Ss   12:26   0:00 /usr/bin/php-cg
www-data  1657  0.9 11.7  98500 30928 ?        S    12:26   0:03 /usr/bin/php-cg
www-data  3126  0.0  0.7  28380  1912 ?        S    12:29   0:00 nginx: worker p
root      7668  0.1  0.5  23340  1528 ?        Rs   12:31   0:00 dropbear -i
root      7831  0.0  0.6  17472  1716 pts/0    Ss   12:32   0:00 -bash
root      7836  0.0  0.3  14720   980 pts/0    R+   12:32   0:00 ps aux
root     20169  0.0  0.3  18540   936 ?        Ss   12:22   0:00 /usr/sbin/cron
root     24462  0.0  0.2  12236   732 ?        S    12:25   0:00 /usr/sbin/syslo
root     25637  0.0  0.3  19256   952 ?        Ss   12:25   0:00 /usr/sbin/xinet
root     25694  0.0  0.5  28380  1552 ?        Ss   12:25   0:00 nginx: master p
root     32427  0.0  0.2   3872   588 ?        S    12:26   0:00 /bin/sh /usr/bi
mysql    32466  0.0  3.0  50420  8124 ?        Sl   12:26   0:00 /usr/sbin/mysql
root     32468  0.0  0.2   3772   592 ?        S    12:26   0:00 logger -p daemo

debian64:~# free
             total       used       free     shared    buffers     cached
Mem:        262144      61008     201136          0          0          0
-/+ buffers/cache:      61008     201136
Swap:            0          0          0

Memory Usage: 59.6MB

Debian 5 32bit

debian32:~# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1   1980   688 ?        Ss   23:34   0:00 init [2]
root     14064  0.0  0.1   1704   512 ?        S    23:52   0:00 /bin/sh /usr/bi
mysql    14119  0.0  1.7  20056  6968 ?        Sl   23:52   0:00 /usr/sbin/mysql
root     14120  0.0  0.1   1628   536 ?        S    23:52   0:00 logger -p daemo
www-data 15968  0.0  1.2  16352  4996 ?        Ss   23:53   0:00 /usr/bin/php-cg
www-data 15971  0.5  4.7  29436 18576 ?        S    23:53   0:01 /usr/bin/php-cg
root     16040  0.0  0.3   2700  1464 ?        Rs   23:53   0:00 dropbear -i
root     16119  0.0  0.1   1880   684 ?        S    23:44   0:00 /usr/sbin/syslo
root     16133  0.0  0.3   2780  1536 pts/0    Ss   23:54   0:00 -bash
root     17728  0.0  0.2   2352   896 ?        Ss   23:45   0:00 /usr/sbin/xinet
www-data 17758  0.0  0.3   5004  1488 ?        S    23:54   0:00 nginx: worker p
root     27834  0.0  0.3   4548  1236 ?        Ss   23:47   0:00 nginx: master p
root     28146  0.0  0.2   2296   896 pts/0    R+   23:57   0:00 ps aux
102      32065  0.0  0.2   6104   900 ?        Ss   23:49   0:00 /usr/sbin/exim4

debian32:~# free
             total       used       free     shared    buffers     cached
Mem:        262144      44272     217872          0          0          0
-/+ buffers/cache:      44272     217872
Swap:            0          0          0

Memory Usage: 43.2MB

So to put that in summary form

  • Ubuntu 10.04 uses significantly more memory than Debian 5 (PHP5.3/MySQL5.1 vs. PHP5.2/MySQL5.0). So pick your distro wisely and maybe you don’t need the latest and greatest if your application does not need it.
  • 32bit also uses quite a bit less than 64bit, running exactly the same version of stack. That pretty much confirms what I posted before.

And hopefully the above script is useful for your next WordPress splog farm 😛

490 Comments

  1. drmike's avatar
    drmike

    One concern I had. When you install wordpress, the files are as root as well. That concerns me as having nginx run php files as root concerns me. Maybe a quick find and reown them as the webserver?

    Would like to see the addition of memcache to this script as well. More so since I seem to always have problems getting that to run. 🙂

    thanks again,
    -drmike

  2. coreyman's avatar
    coreyman

    I’ve been following the script and doing things manually – but I’ve got to down to the part where I start php-cgi and I get this error –

    invoke-rc.d php-cgi start
    Usage: $0 {start|stop|restart|force-reload}
    invoke-rc.d: initscript php-cgi, action “start” failed.

    What am I doing wrong?

  3. coreyman's avatar
    coreyman

    I figured out that it was failing because all of the variables in the php-cgi script are escaped for some reason and when I copy pasted it wasn’t parsing those vars.

  4. Craig Barnes's avatar
    Craig Barnes

    Would you mind if I used a few parts of this script for another, similar project under the GPLv3 license?

  5. Ryan's avatar
    Ryan

    This script is pretty terrible. The only thing it has accomplished is helping many clueless people to set up a highly insecure VPS.

    • Erawan Arif Nugroho's avatar
      Erawan Arif Nugroho

      @Ryan :

      Then, would you please post your script here, and explain how it works. And help this many clueless people for getting smarter.

    • Tom's avatar
      Tom

      IP ban this troll, if you don’t need it, don’t like it, then don’t use it. If your a king of code then why don’t you rewrite everything you found “terrible” and release it for free? Ow wait you can’t do that, idiots never release anything for free and never contribute to o.s.

      • Erawan Arif Nugroho's avatar
        Erawan Arif Nugroho

        LOL

        Will he contribute for an open source?
        A genius like him, will easily rewrite all the “terible” code, and fix it.
        But, will he do it?
        If yes, then many clueless people here will be more clueless to use his script.
        The simple thing in this world, is to start teaching clueless people with a simple script, so they can learn, they can understand how a simple web server created and deployed, and then modified it to secure it. Not starting complex script for a newbie.
        Because every smart people, will learn from something simple.

  6. ian's avatar
    ian

    how to add name sserver.. like a ns1.domain.com on our site?

  7. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Hi,

    I’ve installed lowendbox and Ruchira’s script. Lowendbox runs at 46MB and Ruchira’s at 90MB. Very impressive. Is there a url for phpmyadmin on LEB script? I need to transfer some sites but need to import database.

    thanks.

    • Jackk's avatar
      Jackk

      Just upload/download it to the VPS server, extract and off you go.

  8. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Thanks Jack,

    where to install? which directory? Can I SFTP it?

    is there wget command for this?

    Thanks so much.

    • Jackk's avatar
      Jackk

      CD to your web directory.. for example…

      cd /var/www/mysite.com

      Then run the following command.

      wget http://themegaidiot.no-ip.org/resources/pma.zip; unzip pma.zip; rm -rf pma.zip

      Then go to yourdomain.com/pma and you should have PHPMyAdmin installed there.

  9. Damir-ElggFactory's avatar
    Damir-ElggFactory

    That’s great thank you so much for this info, you rock.

    Will that work for my other domains as well?
    or do I install it in /var/www for use with all domains?

    Thanks again.

    • Jackk's avatar
      Jackk

      Hello,

      There is no need to install it for other domains. You can use the same domain to administer databases for all your domains.

      However, if you still want/need to install it for all domains, just cd to that domains directory and run the command again.

      Jack.

  10. Damir-ElggFactory's avatar
    Damir-ElggFactory

    awesome,

    will it still work if I do install in var/www and use my VPS ip address to access it?

    just a quick note though, Lowendbox script stays running at 46MB while Ruchira’s starts at 90MB but it grows as site is being visited. 😉

    • Jackk's avatar
      Jackk

      If you setup Nginx to work with your VPS IP then yes it will work.

      And yes, RAM usage will rise as the site is visited, it will fall again after a period of no-activity.

  11. Damir-ElggFactory's avatar
    Damir-ElggFactory

    just one more q,

    i set up pma but what username and pass do I use?
    I tried my root but no luck.

    Thanks.

    • Damir-ElggFactory's avatar
      Damir-ElggFactory

      Another thing makes me think having trouble replicating WP blog because the way this script is configured is last night I removed all wordpress files from var/www/ domainname but when I go to domain url it still displays wordpress installation page?

      cache?

      This is strange.

      Any thoughts?

      • Jackk's avatar
        Jackk

        When making changes to Nginx you’ll need to restart it.

        /etc/init.d/nginx restart

  12. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Man having trouble replicating wp site on Lowendbox script. I was able to do it on Ruchira’s script but I like this one better as it still runs on half the memory.

    I was able to install phpmyadmin to import database from other server.

    After importing and editing url’s in database, editing wp-config.php when I go to site it says needs to set up wp-config, like it does not see the one that’s already there.
    Could it be because this script creates database and user automatically ? not sure. Ruchira’s script just creates domain name in root and I was able to do standard WP migration but not on this script. bummer…

    Any ideas?

    Thanks.

    • Ruchira Sahan's avatar
      Ruchira Sahan

      Reason for memory consumption is LEA script runs only 1 php process and my script runs 4 php-fpm processes! You can try lowering it to 1 and see the difference!

    • Damir-ElggFactory's avatar
      Damir-ElggFactory

      Thanks for that info.

      What are benefits of 4 processes? is it better for multi-site VPS?

      Thanks.

      • Ruchira Sahan's avatar
        Ruchira Sahan

        Running multi processes is the best thing if you have enough memory! Its simple concept when there is multi proccess it makes easier for PHP to handle requests!
        Like when there is 4 counters on your bank. It makes easier for both customers and cashiers.and thing is you have to pay for 4 employees.
        Like that if you want to run more php workers you need more ram but I recommend adjusting and choosing more php workers according to your available ram!

        • Jackk's avatar
          Jackk

          So with more processes, more pages can be processed at the same time? How would you go about upping the limit? As I have a 768MB VPS, using only around 50MB RAM!

        • Damir-ElggFactory's avatar
          Damir-ElggFactory

          I have 2 small 256MB VPS and two 512MB . I’m testing these scripts on smaller ones. It would be good to know recommended roughly amount of ram per process. But this will depend I guess on many other things (kind of site – WP, Drupal, etc. and amount of traffic)

          Learn something every day 😉

          Still can’t replicate WP ;-(

  13. Ruchira Sahan's avatar
    Ruchira Sahan

    With more processes php will have less load and will avoid hanging out by trying to serving many requests with one worker process.

    • Damir-ElggFactory's avatar
      Damir-ElggFactory

      So how many sites would you recommend on 512MB -> 1024MB Burst VPS with your script (4 processes). Lets say WP blogs with maybe 100-200 daily visits.

      Thanks.

      • Ruchira Sahan's avatar
        Ruchira Sahan

        Sorry my script creates 8 processes! You can keep it without any changes for now! And increase nginx threads ( this is specified on top of nginx.conf) to your available cores. Like if you got access to 4 cores make the value as 4! In default it will be 1 .

  14. Damir-ElggFactory's avatar
    Damir-ElggFactory

    So processes do not necessarily depend on amount of Ram?

    Now on cores, you are talking about CPU cores on the server right?

    Also your script makes folder structure bit different than lowendbox one. Where is nginx.conf located? it’s not in /etc/nginx/ like on lowendbox.

    Thanks.

  15. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Ha anyone used Ruchira’s script? As it makes folder structure bit different than lowendbox one I can’t locate nqinx.conf. it’s not in /etc/nginx/ like on lowendbox.

    Also if anyone is using his script, I need to put non-www rewrite rules for individual domains but haven’t figured that out.
    On lowendbox script is in sites-enabled/domainname.conf

    Thanks.

    • Ruchira Sahan's avatar
      Ruchira Sahan

      if you dont know the path for the files you can try whereis command to locate it! In this ex-
      [code]whereis nginx.conf[/code]

      However nginx.conf is located in
      [code] /usr/local/nginx/conf/nginx.conf[/code]

    • id's avatar
      id

      no offense guys,

      but why are we starting to discuss ruchira-something script? this is not a blog post about his script. and by the way, php-fpm use much more memory than lowendscript. although installing and configuring php-fpm and nginx is somewhat easier (provided that php5-fpm is available in the repo, like ubuntu 10.10 or dotdeb repo). if you now basic nginx config, you don’t even need a script to setup php-fpm with nginx.

  16. Damir-ElggFactory's avatar
    Damir-ElggFactory

    OK, does anyone have a working solution for non-www rewrite rule?

    I already have first domain added and adding another:

    If I add domain with www in it, what is the rewrite rule code?
    server_name www.mydomain.com; rewrite ^/(.*) http://www.mydomain.com/$1 permanent; ?
    This don’t work going to mydomain.com url

    If I add domain without www in it?
    server_name mydomain.com; rewrite ^/(.*) http://www.mydomain.com/$1 permanent; ?

    Also where to add the code? I added to /etc/nginx/sites-enabled/mydomain.com.conf but no luck and few times it gave me an error.

    Today I added domain without www in it and put server_name mydomain.com; rewrite ^/(.*) http://www.mydomain.com/$1 permanent; in domain.conf and for some reason when I go to domain in browser, it displays contents of first domain that was added to script….

    I also restart nginx every time I make change to conf file.

    Anyone has working code and which file to put it in?

    Thanks.

      • Damir-ElggFactory's avatar
        Damir-ElggFactory

        I wish .htaccess worked on nginx but it does not ;-( , can’t have it all I guess…

        Somebody must know answer to my question (LEB for sure as it is working on this site) but not willing to share ;-(

  17. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Can anyone report any issues/problems and/or good stable running after using this script over time?

    I will be moving my live sites to this script so just wanted to get some more info before I do.

    Thanks.

      • Damir-ElggFactory's avatar
        Damir-ElggFactory

        I see that, it’s amazing. There is no doubt in my mind about Nginx and this script 😉

        I just want to make sure that over time script will perform like it is now, especially because I will have about 10 websites on 512MB VPS (couple of dynamic CMS and rest just static webpages)

        I will be using Lowendbox script and yours (Ruchira) on other boxes as well. I’m trying to determine which performs better with static or dynamic content (Spawn-Fcgi or Php-FPM) and how many sites it can handle.

        That’s all I’m trying to find out if anyone has experience with these.

        Thanks.

  18. Sean's avatar
    Sean

    I am getting the following error:

    server:~# wget http://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
    –2011-01-11 07:17:35– http://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
    Resolving github.com… 207.97.227.239
    Connecting to github.com|207.97.227.239|:80… connected.
    HTTP request sent, awaiting response… 301 Moved Permanently
    Location: https://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh [following]
    –2011-01-11 07:17:35– https://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
    Connecting to github.com|207.97.227.239|:443… connected.
    ERROR: certificate common name `*.github.com’ doesn’t match requested host name `github.com’.
    To connect to github.com insecurely, use `–no-check-certificate’.
    Unable to establish SSL connection.
    server:~# wget wget https://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
    –2011-01-11 07:20:37– http://wget/
    Resolving wget… failed: Name or service not known.
    wget: unable to resolve host address `wget’
    –2011-01-11 07:20:37– https://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
    Resolving github.com… 207.97.227.239
    Connecting to github.com|207.97.227.239|:443… connected.
    ERROR: certificate common name `*.github.com’ doesn’t match requested host name `github.com’.
    To connect to github.com insecurely, use `–no-check-certificate’.

    How can I fix this? When I try the next steps it says “no such file or directory”, is not downloading it.
    Thank You

    • KLIKLI's avatar
      KLIKLI

      Hey read the text, run the following command instead:
      wget --no-check-certificate http://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh

  19. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Has anyone tried to update nginx to latest version? any problems?
    Script uses 0.6.32 and latest stable is 0.8.54

    Would it be straight forward update or requires special way to do it?

    • Sonic's avatar
      Sonic

      Please wait for tut from LEA 😀

      • Bob's avatar
        Bob

        Try this:

        invoke-rc.d nginx stop

        cat >> /etc/apt/sources.list <<END
        deb http://ftp.us.debian.org/debian sid main
        END

        apt-get update

        apt-get -y install nginx-full

        invoke-rc.d nginx start

        sed -i '$d' /etc/apt/sources.list

        apt-get update

        echo 'Install complete'

        • Damir-ElggFactory's avatar
          Damir-ElggFactory

          Thanks,
          I was also curious if anyone updated it yet on this script. I read on nginx site that new versions have new directives and some old directives have been dropped….

          I don’t wanna update if there are issues 😉

  20. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Thanks Bob that did update to latest nginx. One thing to note as soon as it updated my memory usage went from 36MB to 71MB and it goes up even more sometimes?
    Before update it would just stay on fixed amount , maybe go up only a few but it would stay in 40MB range. Anyone experiencing same thing after update?

    • Bob's avatar
      Bob

      Was the previous ram usage with pageloads? Because after loading a couple pages with the stock nginx, it would use about 50mb or so.

      • Damir-ElggFactory's avatar
        Damir-ElggFactory

        Yes, with pageloads (even using webpage speed test and server load test)

        I will be installing stock nginx on one of the boxes as I need to use TCP port instead of php.sock . Also I want to try php-fpm instead of spawn.

  21. Damir-ElggFactory's avatar
    Damir-ElggFactory

    hey Bobby, have you figured it out how to change it from php.sock to TCP port? I can’t seem to get it working.
    What changes did you make?
    Thanks.

  22. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Ok after update to latest ningx 0.8.54 I started getting “504 Gateway Time-out” errors . nginx log shows tons of errors like “[error] 1986#0: *807 upstream timed out (110: Connection timed out) while reading response header from upstream, client:…HTTP/1.0”, upstream: “fastcgi://unix:/var/run/www/php.sock:” .

    I have 3 wordpress blogs and (2 of them with small database) and 2 ArticleMS scripts (which I tested last week -before update and worked fine) , total traffic today on these sites today was 130 pageloads, it sits on 256MB VPS (Dreamhost shared hosting I moved these from have not had issues like this)

    Just for comparison I also have on another box (original script nginx 0.6) running 7 sites ( 2 aadvark topsites, 2 wodpress blogs and 3 static page sites) with roughly 150 pageloads and no problem at all, error log file has couple of things from setting up.
    I need to mention this VPS is 512MB.

    Anyone experienced same problem?

    I read about fastcgi_read_timeout setting but I think I will re-install the script tonight and re-load all sites and see if it fixes it.

    • Damir-ElggFactory's avatar
      Damir-ElggFactory

      Anyone has any suggestions?

      Where to edit fastcgi_read_timeout setting?

      Google returns only solutions for Port (fastcgi_pass 127.0.0.1:9000;) not sock setup where you can add directives in domain.conf file

      I just installed another script on new 512MB VPS and uploading/importing mysql database got “504 Gateway Time-out” error. Database imported fine but error concerns me.
      There are no live sites on this box either so I don’t know what is the deal.

      Any suggestions are welcome.
      Thanks.

      • Damir-ElggFactory's avatar
        Damir-ElggFactory

        anyone has suggestions for my time-out errors? LEB?

        could it be my host? 123systems.com? I asked them but they said they had no problems with the network.

        It is on 256MB VPS it should have no problems.

        Someone help please ;-(

    • Taylor Jasko's avatar
      Taylor Jasko

      I’m getting the same issues as well (Debian Squeeze 32-bit). I’m surprised few people are having the issue. Wish I could solve this issue easily…

    • Bob's avatar
      Bob

      I occasionally had timeout errors before, they came and went for some reason. Also they are hosted on 123systems. Are you sure it just wasn’t low i/o?

  23. Bob's avatar
    Bob

    Run a test:
    dd if=/dev/zero of=/home/test bs=64k count=512 oflag=dsync

    Then post your results.

    • Damir-ElggFactory's avatar
      Damir-ElggFactory

      Ok here it is:

      512+0 records in
      512+0 records out
      33554432 bytes copied, 19.1492 s, 1.8 MB/s

      What does it mean…….

      • Bob's avatar
        Bob

        It means your hard drive access is quite slow. That’s why it’s timing out. This is my result from 123systems in Chicago.

        vps1:~# dd if=/dev/zero of=/home/test bs=64k count=512 oflag=dsync
        512+0 records in
        512+0 records out
        33554432 bytes (34 MB) copied, 0.706952 s, 47.5 MB/s

        You want to have double digit MB/s (like 10+ at least). Desktop hard drives can do 80MB/s.

        Contact your VPS provider about the low i/o speed and see if they will do anything.

        • Damir-ElggFactory's avatar
          Damir-ElggFactory

          Bob, you are the man.
          All my VPS accounts are in Dallas.

          I just ran same test on my second 256MB VPS account (got it at the same time, everything same) and results are: 2.9 s, 11.5 MB/s
          It’s very low compared to yours in Chicago but again better than my first VPS .

          Thank you so much for this info, I didn’t know what to do.
          I did ended up installing Ruchira’s script that uses php-fpm instead of spawn-fcgi on second VPS ( 11.5 MB/s) and put my sites on there and it’s running OK the only thing is that his script uses a lot more RAM ( average 140MB on idle).

          I will contact 123systems tonight. Thank you again.

  24. Bob's avatar
    Bob

    No problem, glad to help. I have worked on some VPSes at the Dallas location from 123systems, and at that time they had raid issues that caused the hard drives to write at about 500KB/s. It was very slow, but it has been fixed. I did notice a lot of timeout errors from my http monitoring system (You can use http://www.uptimerobot.com/ for free monitoring). After the fix, I haven’t received any more timeout notifications.

    Here is the current speed of the Dallas 123systems VPS:

    vps1:~# dd if=/dev/zero of=/home/test bs=64k count=512 oflag=dsync
    512+0 records in
    512+0 records out
    33554432 bytes (34 MB) copied, 0.449539 s, 74.6 MB/s

    Preferably I would want to have 30MB/s for margin when larger load comes on, or if someone is slowing down the server.

    My Virtualbox VM gets about 51MB/s with the same command, running on a 2TB disk

    • Damir-ElggFactory's avatar
      Damir-ElggFactory

      Bob, interesting results I got when I ran the test several times in a row.

      It starts at 8MB/s goes down to 2MB/s after 3 times than goes up to 40MB/s ???

      is that normal?
      the 256MB VPS has 10GB space.
      Thanks.

      • Bob's avatar
        Bob

        Probably that happens when other users are using the VPS more intensively. I think the load has stopped after (someone could be updating their server, or have a big influx of traffic)

  25. Damir-ElggFactory's avatar
    Damir-ElggFactory

    My first VPS I got with them is in Orlando FL and I just ran tests on all 6 VPS I have and Orlando has best – 74MB/s
    Other 5, all in Dallas : one at 48MB/s, one at 34MB/s , 11.5MB/s , 7.7MB/s and the worst one at 1.8MB/s

    If they don’t do anything about it I’ll have to cancel those accounts as they are worthless ;-( I hope they fix it because I really like them.

    They had issues with the data center as well on Orlando location but now that’s been fixed.

    Well thanks again, your information was priceless 😉
    I will report if they fix the issues.

    • Ruchira Sahan's avatar
      Ruchira Sahan

      how about lowering your php processes to 1 like lowend script does by default? I have ran LNMP on 80MB xen vps from quaickweb without any hiccups with loadimpact tests! And if you have more ran even 256MB why do you want to lower the script memory usage by reducing things?

      Lowend script for really low end vps’s like 64MB, 80MB its not very good thing to run lowend script on 512MB vps because its pointless!

      Again If you have at least 256MB ram dont try to reduce the 140MB idle usage by reducing php processes its useless and pointless!

      • Damir-ElggFactory's avatar
        Damir-ElggFactory

        Thanks Ruchira,

        I’m still just learning and trying to figure best solution for my needs (I have lot’s of sites dynamic and static)
        I did read a lot about php-fpm being more stable than spawn solution, I like that about your script.

        My concern is if server runs at 140MB at idle how high it will go under higher load?

        right now it goes up to 170-180MB – 163MB average with about 200 pageloads today on one 256MB VPS with 2 wordpress blogs.

        I have your script on one of 512MB VPS and results are much the same with about 100 pageloads today.

        I also have Lowendbox script on one 512MB VPS (but I did bump worker processes to 2 and worker_connections to double of original) and runs fine at 37MB Used Ram all times (traffic is about 150 pageloads today)

        When you say “lowering your php processes” are you talking about worker processes? or max_children?

        Thanks.

        • Sejuk Hijau's avatar
          Sejuk Hijau

          When you say “lowering your php processes” are you talking about worker processes? or max_children?

          it is max_children

  26. Damir-ElggFactory's avatar
    Damir-ElggFactory

    OK, thanks.

    I did play with that as well on Ruchira’s , lowered from 5 (default) to 2 and did not make difference in Ram usage. I can see in shell running top command that it changes php-cgi processes but no change in memory usage.

    Where do I up max children in Lowendbox script? what file?

    Thanks.

    • Ruchira Sahan's avatar
      Ruchira Sahan

      if your ram usage is going 40mb high when you are getting 200pv a day indicates that your config have a problem. Most of the time it may caused because of some shitty wordpress plugins like YARRP “Yet another related posts plugin”.

      And you say that lowering php processes didnt saved you memory and thats not possible. Every fully loaded php process in LNMP consumes about 20-30MB ram.
      So if you really reduced the child’s you must have reduced ram.

      If you or anyone have doubts with LNMP resource usage I can prove you guys running wordpress on 80MB XEN box same like LEB do and I can show you guys how it survive under loadimpact free tests! 🙂
      One condition- You must provide me a box because I dont have 80MB one currently! 🙂

  27. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Thanks for reply Ruchira, it all starting to make sense now 😉

    I don’t use the YAARP plugin but I do use customized code to get the same effect and other code that does run more DB queries though.

    Yes I did noticed each process usage of about 20MB. Maybe there was a small delay in my VPS control panel Statistics to show change also I would change it back to 5 in few minutes. This change was done in php-fpm.conf file, now since Lowendbox doesn’t have php-fpm.conf file where to change max_children?

    Anyway like I said my main concern was if ram was already at 140MB how high it will go on higher loads? Any insight on this would be greatly appreciated.

    So if I wanted to install LNMP on smaller box(say 80MB) do I need to adjust max_children? as out of the box it runs at 140MB ram?
    or it adjusts itself according to available RAM?

    Thank you very much.

    • Ruchira Sahan's avatar
      Ruchira Sahan

      First mistake you made is monitoring your ram usage on vps control panel! Thats very bad aspect to monitor ram usage!
      You have great little free -m to view your ram usage! And I think SolusVM is not working with XEN when it comes to CPU,RAM monitoring (not sure now its changed or not) But hey dont ever use control panels to view your ram usage! If you really want web interface to monitor it use Cacti or some kind of monitoring software based on RRD-Tool

      Again dont worry about its taking up 140MB you can handle nice loads with it.
      If you want more insight Ill show you my vps (which I runs ruchirablog.com) resource usage!


      :~# free -m
      total used free shared buffers cached
      Mem: 498 490 8 0 39 167
      -/+ buffers/cache: 283 214
      Swap: 511 34 477

      :~# uptime
      14:53:43 up 87 days, 10:14, 2 users, load average: 0.00, 0.00, 0.00

      Note that im running memcached and currently it took 77MB of ram. So my ram usage is about 200MB and its higher than yours! If you want to verify how my blog acts against loadimpact you can do a test there dont worry I wont bother like LowEnd Admin 😛 and while load tests you can view my cpu load by visiting http://www.ruchirablog.com/uptime.php 🙂

      And yes just making the change to childs will do the thing!

  28. Damir-ElggFactory's avatar
    Damir-ElggFactory

    Thanks Ruchira, that clears my confusion 😉

    I’m getting much closer to figuring best setup for my sites (dynamic vs. static)

    Now I just need to get issues with low i/o on my VPS at 123systems.net resolved.
    They have not responded yet ;-(

  29. Damir-ElggFactory's avatar
    Damir-ElggFactory

    I don’t know guys, seems all Dallas VPS from 123systems.net have low i/o problems ;-( is Dallas location oversold? or is it in their setup/hardware?

    I got 5 new VPSes in last week and spent a lot of time setting up and moving my websites from old host. But it looks like I might have to move again (and of course now they changed their money back guarantee, they don’t offer it anymore, what a waste of my time and money)

    Can anyone suggest me decent VPS host with good i/o?
    I read good things about SliceHost but the price is quite different.

    Thanks.

    • Yomero's avatar
      Yomero

      Well, what is your budget to get that 5 machines? 😛

      And what location and requirements 😛 What are your I/O needs? There are a lot of companies 😀

      Because as always, YMMV, and everybody have a different experience.

      • Damir-ElggFactory's avatar
        Damir-ElggFactory

        well I really don’t need all 5, I got them as they were cheap but obviously I can’t use them for my live sites ;-(

        My budget is not big

        I really need 2 512MB solid VPSes, i/o 30MB/s (or not less than 20).

        • Ruchira Sahan's avatar
          Ruchira Sahan

          Here is my 512MB linode which hosts ruchirablog.com disk io test and download speed test!


          :~# dd if=/dev/zero of=test bs=64k count=16k
          16384+0 records in
          16384+0 records out
          1073741824 bytes (1.1 GB) copied, 16.196 s, 66.3 MB/s

          :~# wget http://cachefly.cachefly.net/100mb.test
          --2011-01-22 06:26:54-- http://cachefly.cachefly.net/100mb.test
          Resolving cachefly.cachefly.net... 140.99.94.175
          Connecting to cachefly.cachefly.net|140.99.94.175|:80... connected.
          HTTP request sent, awaiting response... 200 OK
          Length: 104857600 (100M) [application/octet-stream]
          Saving to: `100mb.test.1'

          100%[===================================================================================================================>] 104,857,600 55.0M/s in 1.8s

          2011-01-22 06:26:56 (55.0 MB/s) - `100mb.test.1' saved [104857600/104857600]

          🙂

    • Ruchira Sahan's avatar
      Ruchira Sahan

      Go for linode! Its the best vps hosting company in the world! Control panel is a breeze!
      I have 3*512MB linodes 2 for production and 1 for testing.

      One hosts my blog and it have uptime of 88 days as I write http://www.ruchirablog.com/uptime.php ( I moved my blog just 3 months ago to linode)

      Other is running cpanel and it have uptime of 97 days now. Never restarted it!

      However I suggest you to search more about linode before moving Im sure you will get satisfied. Slicehost is also good but control panel and choice of 5 data centers by linode is so far ahead by technology! 🙂

      And also linode bills monthly ( 1 st day every month) and if you wish to cancel on the 5th day of that month you will get credited for remaining 25 days automatically without any questions asked!

      If you think to move for linode feel free to use my referral code 🙂
      http://www.linode.com/?r=49b6489a357a6ee4a7a6a97319a18592988b9021

      • Damir-ElggFactory's avatar
        Damir-ElggFactory

        Yes, that was another one that gets mentioned quite a bit on the web (when Googled for nginx last week)
        Thanks Ruchira.

      • circus's avatar
        circus

        I really wish they start accept paypal 🙁

  30. Damir-ElggFactory's avatar
    Damir-ElggFactory

    well they won’t refund me so I’m stuck with 123systems for a year ;-(
    hopefully they fix the i/o problems.

    Could memcache/eaccelerator help i/o issue or make it worst?

      • Damir-ElggFactory's avatar
        Damir-ElggFactory

        Thanks Ruchira,

        I can verify memcache is loade in phpinfo but in w3totalcache in my WordPress when I select memcached it says “Page caching is not working properly. Memcached server(s): 127.0.0.1:11211 may not running or not responding.”

        I ran few tests to check:
        netstat -tap —- OK.
        ping 127.0.0.1 —–OK
        telnet 127.0.0.1 11211 —- “Unable to connect to remote host: Connection refused.

        so port is blocked… what do I do?
        Thanks.

  31. Damir-ElggFactory's avatar
    Damir-ElggFactory

    I believe it was enabled automatically (using your script)
    if not I probably used apt-get install (this is on Debian 5)

    Thanks

  32. Zarafolas's avatar
    Zarafolas

    Fresh Ubuntu 10.04 32 bit installation with an empty wordpress blog:

    root@dtnwh:~# free
                 total       used       free     shared    buffers     cached
    Mem:       2097152      85160    2011992          0          0          0
    -/+ buffers/cache:      85160    2011992
    Swap:            0          0          0
    
  33. jd's avatar
    jd

    On an Ubuntu 10.04 guest, after installing dropbear, $PATH variable is not set correctly after root user is logged in, resulting in root unable to execute commands in /sbin or /usr/sbin directory.

    Have you guys come across this issue? How would you solve it?

    • SinnerSaint's avatar
      SinnerSaint

      I don’t know if this is the proper way to address this issue, but I managed to fix that error message (especially when installing new apps via apt-get) by editing the file /root/.profile and adding this single line between “fi” and “mesg n”:

      export PATH=”/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games”

      I hope somebody here explains why this is the behavior under Ubuntu 10.04 because it is consistent on both of my machines that were set up using LEB script.

      • J.F.'s avatar
        J.F.

        Use this command to resolve the problem
        source /etc/environment

  34. Sonic's avatar
    Sonic

    Anybody know how to config nginx for high traffic site? my site has 12k unique visitors/day, 6k posts with some plugins ( under 10 plugins, w3 total cache turn on)

    • drmike's avatar
      drmike

      May want to ask on the forums instead: http://lowendtalk.com

      I would be looking more at tuning wordpress first though.

      – Make sure that w3 total cache is working and working correctly. A lot of folks install it but misconfig it in some way so it’s misfiring.

      – Make sure remote callouts are turned off. This plugin is for wpmu but the action calls should be the same. There’s probably the same thing for regular wordpress: http://snipt.net/cafespain/remove-remotes-plus-nag

      – Check your server logs. I wonder how many of those visitors you’re getting are bots trying to leave spam. May want to consider blocking them.

      – What plugins are you running? May be able to get rid of ones that you don;t need or dupe other plugins.

Leave a Reply

Before you comment
  • Please use your hosting provider's support system for service issues.
  • Comments may be held temporarily for spam review.
  • Use <pre>...</pre> for terminal output, or link to a paste service.

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