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.
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“.
- 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.
- 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 ...
- 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 :P
- 5 Reasons Why You Want a Low End Box - May 26, 2021
- Dead Pool January 2012 - February 2, 2012
- exit(0); - January 19, 2012
great one, thanks for sharing. now, who’s up to convert it to centos? :)
Why would you want to do that?
Nice job. Thanks.
Will check against my own configuration.
Very cool! :-)
I can see what I can do to convert it to CentOS.
I get the following when I tested it for my main blog. Is their anyway to tune this? I have little knowledge of nginx
502 Bad Gateway
nginx/0.6.32
Another great post with much more info then the old post.
again when are you providing such a nice tutorial on postfix install and full configuration for virtual domains
Many Thanks.
@Qwizie — 502 Bad Gateway means Nginx cannot talk to PHP fastcgi.
Make sure your PHP are running. I have installed the init script at /etc/init.d/php-cgi, and just do
invoke-rc.d php-cgi start
to start it.It did work until I change A record for my major traffic site to the IP and now that’s all I get.
vps:~# invoke-rc.d php-cgi start
Starting php-cgi: php-cgi/usr/bin/php-cgi already running.
invoke-rc.d: initscript php-cgi, action “start” failed.
Is their a way to tune PHP to handle more PHP CGI requests?
Will then I guess you need to “restart” rather than “start” then. You can put
PHP_FCGI_CHILDREN=3
/etc/default/php-cgi
or whatever number of children processes you want there. But remember they all use up memory :)
@LEA :”respawn after 5,000 requests”
Can you give explanation to this?
Thanks
Hmm…
i mean, why 5000 ?
Not some smaller number
Just some random number that works for me. Restarting the child process before too much memory leak (if any). Don’t you also reboot your Windoze box every 7 days? :)
Nope, my Windows machine has been running for like 2 months straight without a hitch.
Lies… Everyone knows Microsoft products are incapable of running more than 24 hours without falling over.
Why are you commenting on a 2011 post?
And about Microsoft Products, maybe it depends on the provider. I have 512MB Windows 2008 VPS which is running for 2 months without problem. The only restart will be happened if I turn on the automatic updates,
I don’t restart any windows boxes ever, because I don’t have any.
Installed it at debian 5 32-bit(spacerich canis) and it’s wordpress 3 for only 50MB total usage! my initial try of normal wp3 installation on lighttpd eats more than 384MB (from a how-to-forge tutorial)… I have to downgrade back to 2.9.2… I’ll stick with this setup for now. Thank you! :D
heh
PHP_FCGI_CHILDREN=75
and my.cnf is skip-innodb and 100 conn and to cache.
top – 08:35:27 up 3:24, 3 users, load average: 26.27, 15.94, 7.08
Tasks: 52 total, 22 running, 22 sleeping, 8 stopped, 0 zombie
Cpu(s): 93.1%us, 6.9%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 524288k total, 521748k used, 2540k free, 0k buffers
Swap: 0k total, 0k used, 0k free, 0k cached
It loads at times, and others not. I wanted to see if I could put a high traffic site on a lowendbox using this setup.
@LEA.
OK, thanks for the clarification. Actually i set the number to 50 request. And yes, just a random number :D.
Hmm.. i don’t use windows , just use ubuntu :D
@Qwizie – 75 is most definitely too many for probably any size of sites on a single box. Usually I will only use 1-2 times the number of CPU cores (unless your PHP processes spend too much time on IO wait, which is a problem in its own), and for a simple WordPress site like LowEndBox.com, PHP_FCGI_CHILDREN=1 is more than enough. Too much causes to use too much memory. And in your case there is no swap so the process probably just get killed.
@bekanosky – 50 is probably fine since PHP starts up pretty fast.
@LEB
I’m receiving around 150-200 HTTP connections a second. So I increased it to the amount I had around in my lighttpd config on my dedicated. But I was still stocked to see that it somewhat worked.
150-200 HTTP connections per second does not translate to 150-200 PHP requests per second, does it? Your OpenVZ VPS is running next to no memory and with 75 FastCGI PHP processes, even at 10MB each (even WordPress 3 brings them to ~30MB) will get you to 750MB — so your VPS is probably suffering from OOM at the moment.
My other site with ~75 HTTP req/second uses about 6 PHP processes, just to give a point of reference.
LEA,
how to check http req/second and php request/second?
@Josh — for HTTP, use a script to query Nginx status module.
For PHP requests, well grep your access log for that :)
I get error at step 4, please let me know how to solve :D
bash setup-debian.sh nginx
root@endor:~# bash setup-debian.sh nginx
Reading package lists…
Building dependency tree…
Reading state information…
Package nginx is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package nginx has no installation candidate
nginx installed for nginx
setup-debian.sh: line 147: /etc/nginx/conf.d/lowendbox.conf: No such file or directory
invoke-rc.d: unknown initscript, /etc/init.d/nginx not found.
Distro info: Ubuntu 10.04 – (x64) – PyGrub
@minhmeo
I guess you should look at your /etc/apt/sources.list
some working example : http://www.asim.pk/2010/07/25/not-getting-a-package-on-ubuntu/
and then run ‘apt-get update’
@Minh — Nginx is part of the universe repository on Ubuntu, so make sure you have universe on your apt/source.list. For example,
Maybe I will need to check that in the script…
@bekanosky: Thanks, but i got another error from first step :D
E: Type ‘main’ is not known on line 1 in source list /etc/apt/sources.list
E: Type ‘main’ is not known on line 1 in source list /etc/apt/sources.list
E: The list of sources could not be read.
@LowEndAdmin: Great, it’s working fine :D Many thanks!!!
When i upgrade plugin on WordPress, it required FTP info, what should i do now? Should i type SSH info?
@minhmeo
ah, you should ask asim for this issue :D.
But, i guess you missed ‘#’ in first line when doing copy-paste
@Minh — no one should use FTP for upgrading WordPress. Well this script is only getting the sites going and as a demo on how to script something to bootstrap a site running on a low end box. Although for production sites I’ll put more thoughts on how to maintain it in the long run.
Also you might want to look at using subversion to maintain your WordPress installations, including plugins.
Thanks! i will upgrade manually :D
After doing all steps, i run “free -m” to see ram usage and it’s 115mb, is it normal? :D
I do “reboot” and my site get error: 502 Bad Gateway
I see that you told “Qwizie — 502 Bad Gateway means Nginx cannot talk to PHP fastcgi.”
and i run command “invoke-rc.d php-cgi start” or “invoke-rc.d php-cgi restart” but system say: -bash: invoke-rc.d: command not found
How about replacing MySQL by SQLite database in wordpress? it use less memory.
You can also replace exim4 by ‘ssmtp’ (Extremely simple MTA to get mail off the system to a Mailhub).
This look great, I’ll try it out when rackvm goes back online.
@Minh — might need to use
update-rc.d php-cgi defaults
to add php-cgi to RC. Please dig Debian manual on that although I should have added that into the script. And are you sure you are using Debian/Ubuntu based system — sysv-rc package should have been installed. Also you need to be running as root :)@Unknown — SQLite is not supported by stock WordPress, and as I am always grabbing the latest release there is no guarantee that 3rd party plugins will work. There are other excellent blogging engines such as Habari that uses SQLite. I am only using WordPress because LowEndBox uses it, and it seems to be a quite popular choice.
As of SSMTP yes I have used that in my 32MB VPS example last year. But it’s error prone, no queue and little guarantee of delivery — unless you are running a stable relay somewhere else. I much prefer to have a box that is self-contained.
If folks have a Gmail account, they can use SSMTP through Gmail.
http://www.pungit.com/tag/ssmtp-on-debian/
Does any body know how I get nginx to display directory listings?
@LowEndAdmin: Yes, i’m running as root. I still get error
root@endor:~# update-rc.d php-cgi defaults
-bash: update-rc.d: command not found
@minh
maybe ‘/etc/init.d/php-cgi start’ will do the job
@bekanosky:
root@endor:~# /etc/init.d/php-cgi start
* Starting php-cgi php-cgi start-stop-daemon: Unable to open pidfile ‘/var/run/www/php.pid’ for writing: No such file or directory (No such file or directory)
Looks like you did not run `bash setup-debian.sh php` properly? It should have
I am pretty sure it has been tested on Ubuntu 10.04. It actually calls `update-rc.d php-cgi defaults` at the end of installing PHP so PHP/FastCGI will start after reboot.
Something wrong on your end.
The same thing happens to me. I already reinstalled my VPS three times with the same OS (Ubuntu 10.04 32-Bit) and followed the instructions you provided. The script was run without any errors encountered and I was able to set up a blog. The only problem is whenever the server is restarted, php-cgi and mysql does not automatically run.
The reason why this is happening in Ubuntu only is because whenever you restart the server, the `/var/run/www` directory is deleted automatically. I tried this script in Debian 5 and there are no problems there.
My only workaround is to manually run the following commands manually after each server reboot:
invoke-rc.d mysql start
mkdir -p /var/run/www
chown www-data:www-data /var/run/www
invoke-rc.d php-cgi start
Do you have any way to make this automated or at least make the functionality working? I tried editing the files /etc/nginx/fastcgi_php and /etc/init.d/php-cgi to change the directory of the php.sock and php.pid but it’s not helping either.
I still have the same issue. Any workaround/fix for this?
I had the same issue, the problem is that ubuntu uses a RAM-disk for /var/run, so changes to the dir structure are not preserved through a restart.
If you dig through the /etc/init/mounted-* config files you can probably figure a way to make changes permanent, but I just modified the init script to move the socket and pid files to a directory on /var/www which I know is on a disk partition.
I have fixed this problem by editing the script and changing the location of where the pid file is stored prior to running the script. Instead I am installing it to /var/lib/www.
Apparently /var/run is not a good spot to put things. Source: http://ubuntuforums.org/showthread.php?t=996892
I have actually created a fork of the original script on Github to add functionality for Drupal installations and fixed this bug along the way.
https://github.com/sk33lz/lowendscript
LowEndAdmin – Any idea how I get nginx to output directory listings for directory’s with no index file. I currently get a 403 error.
Jack.
I have the same error
403 Forbidden
nginx/0.7.67
@Jackk:
Put autoindex on; inside the location directive for that directory.
It isn’t, however, that simple to make it work. You have to move the root statement out of the location. (More info)
@Jackk — http://lmgtfy.com/?q=nginx+directory+list&l=1
@LowEndAdmin: I did exactly as your tutorial and it’s working fine, wordpress blog run fine, but ram usage so high (>500mb ram) so i “reboot” and i get error “502 Bad Gateway”
Well the young padawan — it is your opportunity to figure out exactly why it is using 500MB of memory. A simple `ps aux` would tell you a lot where all that memory went :)
Thanks to both above -LEA’s solution worked. :-)
@LEA: ps aux. And this is result :D
Spot the odd one out :) Your process pid=582 seems to be doing naughty things.
That’s right! How can i solve this? I run wordpress blog with high traffic (online at the same time is 100-200)
@Above – Run;
kill 582
And it will kill the command.
@Jackk: did it, but ram usage still high: 513 :D
Run ps aux again for me..
jack
@ Jack: please see pics:
http://img201.imageshack.us/img201/5628/screenshot2807201022161.jpg
http://img227.imageshack.us/img227/2526/screenshot2807201022160.jpg
@ Jack: please see pics:
img201.imageshack.us/img201/5628/screenshot2807201022161.jpg
img227.imageshack.us/img227/2526/screenshot2807201022160.jpg
@minhmeo
just wondering, why there are so many kernel processes in your ‘ps aux’ result in comment #43.
@bekanosky: hard to say cos i’m newbie here :D
I added your Gtalk id, can you help me to install this? I will give you my vps, then you install it and write steps you did to make it running fine. Is it OK?
Thanks!!!
quick suggestion: install php5-fpm from the dotdeb.org repositories instead of the default PHP fastcgi implementation.
btw, my suggestion is to improve the script, not for any special problem :)
@minhmeo
I already write tutorial about this nginx-phpfcgi-mysql-wordpress in indonesian.
If not lazy, i will have translated it to english.
And i think, this lowendscript do much more than what i wrote.
So, just make sure to execute this script properly and i’m sure it will be okay.
57.59ram on rackvm debian
Thanks for publishing this package, seems to work great!
Admin, many thanks for the install script, please if anyone can add drupal along with?
What about using a flat-file blog instead of WordPress? It may not be as powerful, but it won’t require a MySQL Server running.
Could you add setting up phpmyadmin to the script ? cause I can’t seem to get it working on nginx ?
@Maller – I can help you setup the script. Send me an email on the email address on the page below.
http://178.63.252.43/email.txt
@Maller: you can follow tutorial here, auto script:
http://www.rockia.com/2010/05/how-to-set-up-lnmp-on-debian-ubuntu-or-centos
@maller
you can try sql buddy. jquerty based; very simple and lightweight.
http://www.sqlbuddy.com/
Hello,
The Cron system doesn’t seem to work on my system?
Jack
I found that why my ram usage is so high. Because i’m using Xen VPS :(
How can i reduce ram usage?
Someone smart should add a low resource SMTP/IMAPD (or POP3) addition to this stack. :)
@Raj – In my opinion it’s easier and better to out source your email to something like Google Apps. Google Apps provide 50 emails accounts free of charge for each of your domains – each account has a massive 7GB storage space like any normal Gmail account.
http://www.google.com/a
Jack xD
@Minh — probably because you have read the command `free` wrong :) All your cache/buffer should probably be counted as “almost-free”.
@Raj — what Jack said. Google Apps is probably a much bettered hosted email option, unless you are providing IMAP/POP3 for clients.
@LEA
I have tried the script under my RackVM OpenVZ VPS, with Debian 5 Lenny 32bit, and the memory used is about 47Mb. I have a question, since I install the wordpress at http://www.noenoey.com, but when I open my website with http://noenoey.com, it only shows ‘Welcome to Nginx’.
How do I set the domain, so when I open it with or without www, it still the same?
And also, when I open the website using the IP, it shows the wordpress?
If you change wordpress to some other CMS and you get “no input file specified.” on firefox (yes, for some reason only on firefox!) go to /etc/nginx/sites-available and erase all default info and only leave your created config in /etc/nginx/sites-enabled
Probably true. From my knothole, I’ve got about 8 years of personal Maildir format mail and a handful of mail mailing lists that I’d like to be able to move from host to host should I find paritcular hosts’ service going downhill.
Moving that data around is easy postfix/dovecot, but I am not aware that Google Apps has a download all/upload all feature. Does it?
The other issue on low end boxes is spamassassin being a memory hog! I haven’t been able to get the mem usage down enough to coexist with my LAMP stack on other 128MB/256MB low end boxes.
I’ll fiddle around with it some more, maybe I”ll come up with a little blurb to add to this one. :)
@Raj,
If you stuck your email with Google you wouldn’t need to move it every time you moved hosts. You could just simply keep the email in one place at all times.
@Raj — I have run my own SMTP/IMAP server for many years (since ’99) until about 2 years ago I got really fed up with it and migrate all my mails to Google App. Way too much tinkering with spam/virus filters (and SpamAssassin/ClamAV eats memory *a lot*), and just can’t resist the conversation view that Gmail provides.
To move my years of mails in Maildir (I also used Postfix + Dovecot before) I wrote a script to scan through all files in Maildir, and use Gmail’s IMAP interface to copy the data over. Worked well. It is also possible to write something to use Gmail’s IMAP interface to continuously backup mails to your own server. I haven’t bothered though.
@Erawan — you need to put in a Nginx configuration to do the redirection. For example
@Tom — in the end I think it is a good idea to pick up some Nginx configuration syntax :) No input file probably means PHP cannot find the PHP script.
@LEA
Thank you, I will try it :)
Hm…
I wonder,are you the same owner of yang.id.au. LEA?
@LEA: Here is “free -m” resuld, is ram usage 492 :D
root@endor:~# free -m
total used free shared buffers cached
Mem: 531 492 38 0 24 360
-/+ buffers/cache: 108 422
Swap: 511 0 511
Sorry, please help me but my free -m result in code tag
@Minh:
I think you have mistaken about the result given from “free -m”
Your total free memory should be 422.
Though having 100+ used memory is still kinda of a bit too much?
any chance updating the script with lighttpd?
@Allen: thanks, it’s my mistake, i didnt know to read free -m result :D
@eM – I’m sure you can do that manually. Simply remove nginx (apt-get remove nginx) and then use the following guide to install lighttpd.
http://www.lowendbox.com/blog/yes-you-can-run-18-static-sites-on-a-64mb-link-1-vps/
Using Ubuntu 64bit, only using 65mb of RAM, doing nothing but running APT-GET Upgrade and Update before, and running the above script.
free -m
total used free shared buffers cached
Mem: 2048 65 1982 0 0 0
-/+ buffers/cache: 65 1982
Swap: 0 0 0
@LEB
What was your reason starting dropbear with xinetd?
I see your notes about “easier to configure” in your script… but someone expect things in /etc/default/ may be confused.
@terii — well that’s just my setup, because I am actually using xinetd for a few other things so instead of running dropbear in daemon mode + xinetd, I’ll just run dropbear in inetd mode, forked from xinetd.
fang:/var/www# free -m
total used free shared buffers cached
Mem: 256 49 206 0 0 0
-/+ buffers/cache: 49 206
Swap: 0 0 0
This is after a few PHP pageviews. Debian 5 64 bit. 2 PHP FCGI Children and recycling them after 50 requests.
I should note though, that that is a MyBB forum not WordPress running on that server.
I modified it a little to add the ability to set up a database, directory and configure nginx without installing wordpress.
It’s located at http://freevps.tk/downloads/setup-debian.sh and the line to run make it is setup-debian.sh domain {domain}
Obviously you replace {domain} with your domain name.
is there an easier way to chroot sftp or ssh of dropbear?
is the change of host key popup during sftp normal?
Thanks for the benchmark. I knew 32-bit uses less memory than 64-bit, but I was curious about how big is the difference. Now I’ve got a clue about numbers. It is around 38% for your setup — not a negligible number.
Hey thanks for posting on Reddit :P
The difference also varies depending on your software stack, and 38% more would actually be on the low end of the differences — I have seen apps use up a lot more on x86_64.
Some monolithic apps would require large memory foot prints. For example big MySQL installation that needs more than 2GB. Or MongoDB as it uses mmap files. Otherwise I usually just stick to 32bit on my VPS.
Hi, first I would like to say that this script is awesome =)
I have no problem running wordpress via the bash setup-debian.sh wordpress myblog.example.com. PHP seems to work fine on the wordpress blog.
But when I tried to put info.php in /var/www. It just won’t run. It will not parse the php file at all. The source is displayed.
I’m an nginx noobie, what do I have to do to make php work at /var/www and possibly elsewhere. Thanks.
@superbarney:
The problem will be that fastcgi parameterers are not passed in the main nginx configuration I supposed. Accordingly to the lowendbox script, the parameters are added to “/etc/nginx/fastcgi_php” therefore if you want php to work in your root location; You will have to do a “include /etc/nginx/fastcgi_php” in the main nginx configuration which I think should be located at “/etc/nginx/”
Or I think a more maintainable method will be to create another virtual host (For the root directory) and add it into your main ngix configuration. This way you could easily maintain the configuration for each different domains you have on the box.
Thanks for making our lives even more easier with this script!
LowEndAdmin, can you please add Pure-FTPd configuration to this script?
First thing, I wanted to try serving files from my VPS. So I installed nginx to serve files pure-ftpd for uploading files via ftp to nginx’ home directory. But alas, I couldn’t make ftp work however I tried!
@Nickolai — wouldn’t SFTP an better alternative? It should work with Dropbear or OpenSSH. More secure and less hassle with firewalls.
@LowEndAdmin: Maybe it would; I really don’t know. I have no experience here; I think I picked an idea that Pure-FTPd is good on some forum.
Do you mean sftp(1)? http://www.openbsd.org/cgi-bin/man.cgi?query=sftp
It seems to be a client, am I supposed to install sftp-server(8) for a server? http://www.openbsd.org/cgi-bin/man.cgi?query=sftp-server
It would be nice if you added this to a script.
@Allen:
Thanks for the tip but I had a feeling that was the case and did “include /etc/nginx/fastcgi_php” for the vhost that has already been setup for root, which is /etc/nginx/sites-available/default. That is if I’m not mistaken.
After adding that line, I get “No input file specified” as the error message on my browser. =/
I can’t figure out why the wordpress dir is able to use php flawlessly and not root (or possibly elsewhere)
@Nickolai — SFTP is available as long as you have SSH installed (which should already be there when the VPS is setup). For a free client use WinSCP. Or you can use something like SSHFS on Linux, or Expandrive to mount the remote SFTP server as a local drive.
@superbarney
Not sure what are you actually going to do, but “No input file specified” equals to error occured at the end of PHP. You’d probablly see if the path is correct, or you may try to chmod files to 755.
@@Nickolai
Yup! SFTP usually comes installed as a feature with the ssh server that you are using. In this case, dropbear does support sftp protocol. You can use FileZilla (Free of course!) and while you are at the site manager, you can add in to use the sftp protocol.
I think if you are planning to serve a couple of users using FTP. Then I think getting a separate ftp server will be more appropriate than sftp. (I dunno why, but it just seems so, haha). If you are just working alone and wishes to transfer files then sftp will works as fine.
great article thanks.
It would be so nice, if You update nginx version :) in your pack, nginx version is 0.6, but the newest version is 0.7.
@marikh – The LowEndScripts uses apt-get/dpkg for installing Nginx.
@marikh
Try http://www.lowendtalk.com/topic/tutorial-i-made-on-compiling-the-newest-version-of-php-nginx-for-lowendboxs
For compiling the newest version of both nginx and PHP, and including APC support.
@marikh — unless you want the latest features I normally just stick to the distro default so it gets automated security updates. I still have boxes running Ubuntu 8.04 with Nginx 0.5.33. As I am not a Nginx wiz and use probably the most simple functionality it does not really matter to me…
I have used your script and it works. Thanks very much. The one thing I am trying to accomplish but have been unable to do is to have the configs in one place for nginx and use sites-enabled at will.
On another centos server, using php-fpm and nginx, I was able to setup the server with only the nginx.conf file and then adding a subdomain that works for php and wordpress install was as simple as adding another subdirectory to /usr/share/nginx/sites-enabled and installing wordpress in it.
However, I prefer your installation, because for some reason, a wordpress plugin that is needed for me errors out in the php-fpm (php 5.3.3) but works fine in your scripted version. I have not been able to figure out why. (the centos php 5.3.3 server also seems to use more memory)
However, the simplest thing to me would seem to be to configure the debian system to use the conf and sites enabled to do the same thing as my centos server and thus solve all my problems at once.
My nginx.conf is as follows (I have tried to modify it to the best of my abilities)
This works fine on my centos php-fpm server but returns not found errors on the scripted debian.
I really need to be able to add subdomains just by putting the subdomain.myrootdomain.com directory and files in **/sites-enabled/
I would really appreciate some help here. I have been pulling my hair out for a week now trying to get it to work.
I think it wasn’t working because the lowendscript uses unix:/var/run/www/php.sock for FastCGI, whereas your script uses TCP port localhost:9000.
Unix domain socket is slightly faster and good enough for a single box setup.
I should add that your blog is adding http:// to my www
In the server_name line I do NOT have http, just the www . myrootdomain . com
I point this out only to avoid confusion.
So how do I make mine use the php.sock for fastcgi? I could not find anything in any of the confs your scripts created that points to that.
Or is there something in the script that I could change to make it work? Your script really is the simplest LEMP install on the net.
Thank you also for the rapid reply.
My script creates a file called /etc/nginx/fastcgi_php and all the PHP/WordPress sites include that…
I think I fixed it. Let me try and make some adjustments and test it out further.
I am still bleary eyed from lack of sleep, but I will try to test it out.
Bobby, have you figured it out? I need to change it from php.sock to TCP port as well but I can’t seem to get it working.
What changes did you make?
Thanks.
Thank you for the excellent guide, however there is one significant niggling issue. Everything works on first install (Ubuntu 10.04 x86), but after I restart it, I get 502 Bad Gateway. The only way it seems to fix it is to run “bash setup-debian.sh php”, after that it works fine. I tried wiping my VPS and doing it all over again, and the same issue occurs. PHP appears to be in the startup scripts folder, but restarting the php service gives me an error that it cant access /var/www/php.pid
It seems these changes magically get wiped (the folders too), after each restart.
Please help me out LEA
Thanks in advance
I have the same issue.Anyone?
Great work LowEndBoxAdmin
I did a clean install on VPS.NET SAN 2.0 VPS with Basic Debian 5.0 (x64) and followed your steps described above. For the last step, I wasn’t sure if I should use addictinggames.com or http://www.addictinggames.com In the end I decide to use
bash setup-debian.sh wordpress http://www.addictinggames88.com
After completing the wordpress login info, the home page still show a welcome nginx. I followed the rewrite above, but didn’t work. I then change the wordpress/site address under general setting to http://www.addictinggames88.com and the home page was able to load.
A VPS reboot and top show 77496k RAM used. Memory usage after 1 load of the home page is 97348k RAM used.
I have some questions.
1) Do I have to install VSFTPD? If I have to, how do I install?
I need to add at least 10 WordPress Plugins, but I don’t seem to be able to do it within the admin area. It asked for the FTP info, I used the SSH info, it didn’t work.
2) How to upgrade Nginx to 0.8.50?
Nginx version is 0.6.32. I was asked to update to the latest v0.8.50 on one of my VPS as v0.6.32 is not safe.
3) How to replace PHP/FastCGI with PHP/PHP-FPM? If using PHP-FPM, I also need to upgrade PHP to 5.3.3? If I have do, how do I install?
A benchmark test show that PHP-FPM is faster than FastCGI
http://vpsbible.com/php/php-benchmarking-phpfpm-fastcgi-spawnfcgi/
4) How to install APC on Debian?
I like Centos because of yum
5) Will you do a bash script for Centos?
For now, only Centos allow me to scale SAN 2.0 VPS without reboot.
You don’t like Centos because of yum. You like it because you don’t understand Linux enough to make an educated decision.
So, didn’t smart people started from scratch and from zero?
Don’t tell me, that you’re born as a genius, and do nothing without learning.
If yes, then you should teach all of the newbie here, so they can be as genius as you
Eric,
According to my VPS support, Nginx 0.6.32 is the problem and I was asked to upgrade to the latest version.
About the wordpress asking for the ftp details, make sure it has full access to the wordpress directory and is owned by the same user who is running the php files.
(www-data if you used this script.)
@dmmcintyre3,
If I use this script, FTP Username = www-data, what about the FTP Password?
FTP problem solved.
http://desk.stinkpot.org:8080/tricks/index.php/2009/01/wordpress-wants-ftp-information-to-update-plugins/
@AddictingGames88
This is a better way of getting wordpress to work.
http://www.nerdgrind.com/wordpress-automatic-upgrade-plugin-failed-or-not-working/
Well. Real WordPress users use subversion to manage their WordPress and plugin installations so `svn switch` would do the upgrade :)
Hello,
I wanted test webserver for my vps (for learning) so I put “testblog” as hostname (No domain) but when I go to http://myip/testblog it says “404 not found”
Do I have to adjust default.conf & testblog.conf ?
also very much thanks for this script and blog.
Hi LEA:
Do you have any tips to protect Nginx webserver from Ddos attack? Your script is great for me, but today i get ddos and i dont know how to solve this :(
LEA,
I installed your lowendscript and upgraded php to 5.3.3 with
http://www.21andy.com/blog/20100912/1948.html
and
replaced package to http://php53.dotdeb.org
It works fine with php-cgi. When I switch to php5-fpm, it looks fine, but apache benchmark is not as good. I probably missed out something. Can we have a tutorial on how to switch from php-cgi to php5-fpm?
@Rolando — no it does not default to your blog. You can add “listen 80” under “server” in the configuration file for that virtual host and Nginx will pick that up as the default virtual host.
Otherwise you can test by adding the IP address to your local /etc/hosts (or c:\windows\system32\drivers\etc\hosts if you are using Windoze).
@Minh — I still don’t believe there’s a cheap cure for DDoS unfortunately. You might need to buy bigger machine.
@AddictingGames88 — why do you need php5-fpm? Dynamic spawning of new FastCGI processes?
@LEA
Maybe Windows?
@LEA – PHP-PFM is said to be faster than PHP-CGI.
http://vpsbible.com/php/php-benchmarking-phpfpm-fastcgi-spawnfcgi/
Err. That post makes no sense. PHP-FPM uses exactly the same core as PHP-FastCGI, and I can’t see how you can get better performance on standard PHP function calls. It has a much better FastCGI process management though — useful if you want “adaptive process spawning” similar to mod_fcgi in Apache.
@Eric : How to solve FTP problem since
/usr/sbin/setsebool -P httpd_can_network_connect=1
-bash: /usr/sbin/setsebool: No such file or directory
Hi, i’m a newbie on this, i tried to upload file on wordpress and can’t because:
Unable to create directory /var/www/mydomain.com/wp-content/uploads/2010/09. Is its parent directory writable by the server?
I know if in the apache we can use suPhp, how to fix this in nginx? it’s risky if i make the directory writeable.
I also can’t using theme editor on wordpress and update plugins automatically
Thanks
@Nizar,
According to Eric@120, http://www.nerdgrind.com/wordpress-automatic-upgrade-plugin-failed-or-not-working/ is the way. However, when I perform “/usr/sbin/setsebool -P httpd_can_network_connect=1”, I get “-bash: /usr/sbin/setsebool: No such file or directory”
So, at the moment, I used the solution from http://desk.stinkpot.org:8080/tricks/index.php/2009/01/wordpress-wants-ftp-information-to-update-plugins/
@AddictingGames88
Thanks, i got it.
Need help on the following questions
1)How to add new user and disable root for DropBear?
2)If we will to install second WordPress, do we use a new ip address or the same ip as the first WordPress installation?
Hope someone can share the answer
@AddictingGames88
1. I don’t try it yet
2. If you can set the DNS for each subdomains, then you can easily install the second wordpress at the same IP
@Erawan Arif Nugroho,
2. I actually mean installing a second WordPress with a new domain name. Do I dns the new domain name to the same IP Address?
@AddictingGames88
Yes :)
Previously, I have 3 domain names, and I am hosting it in one VPS (with one IP)
Because the nginx will automatically maps the DNS requests to the directory in /var/www/domainname.com
@Erawan Arif Nugroho
That’s cool. I can save some money on IPs.
Hello,
Is it possible to install and configure GD?
Jack.
Err.
apt-get install php5-gd
and then restart the PHP FastCGI processes?Thanks for the handy script! I have got two questions here:
1. Everything is running OK after the installation. However, after I reboot my VPS, it seems that neither mysql nor php is running:
2. When I set up WordPress, I used “www.mydomain.com” as the server name. Is there any way to config both “mydomain.com” and “www.mydomain.com” to my blog?
Thanks
1. They should be automatically restarted. Check whether php-cgi and mysql are in /etc/rc2.d
2. You can add a new file called /etc/nginx/sites-enabled/mydomain.com.conf
LowEndAdmin, thanks again for your script and help.
It is actually true, I can access my site with SFTP without any extra FTP software. I use FireFTP add-on for Firefox, which supports SFTP too! On Windows, I was used to FAR Manager with WinSCP plug-in.
So I managed to make my VPS into a file host with nginx: I ordered a 256MB Xen VPS from 2HOST for $4.94 monthly (SATA variety, originally $5.49, code LEB10TB for 10% discount), did “” did the script up to nginx and uploaded my files. Alas, download speed from my server is around 100 kilobytes/s. If we download from two different computers, it gives us around 100 kilobytes/s each. I tried tweaking around with nginx configuration, but nothing helps.
When I ssh to server and download files with wget it goes 100 kilobytes/s from some locations. From some it is over megabyte/s.
Is the hosting provider throttling me? Can I do anything? Or maybe it’s just misconfiguration on my part?
My site: http://178.18.17.199/
file: http://178.18.17.199/firefox-4.0b6.tar.bz2
@Nickolai Leschov :
Well, many LEB readers are not using 2host services anymore.
Because thay are so slow, and at sometimes, they are down.
Mabe you can read the articles here :
http://www.lowendbox.com/blog/2host-4-04-128mb-xen-vps-with-10tb/
http://www.lowendbox.com/blog/2host-5-21-xen-vps-with-256mb/
Can the second site use a different IP from the first site? If so, how?
You might want to study a bit on Nginx configuration — this script is intended for those who know what they are doing to save time :)
You can use
to have the site on a different IP address.
Thanks for your reply. I will do a bit of study on Nginx configuration. I need different IP as I am moving existing live sites to new server without bring down the sites.
Help pls.. I installed the wp blog using the script, runs fine but im having an error in uploading my WP XML file to upload my posts etc. Error says “Zero Sized Reply” in my browser. Is that error related to the bootstrapscript?
Sorry guys ..i just forgot to set permissions in wp-content/uploads dir.
chmod 755 uploads/ fix it.
BTW i think we can still tune PHP to use less memory in /etc/php5/cgi/php.ini memory_limit = 128M
and set memory limit to 64.
That’s the maximum memory that PHP can use, but not necessarily the amount that it would use during an execution of a script.
ok ..after i rebooted my vps php-fcgi dont auto start. have i missed something in the script?
Any idea how to restart the PHP processes? I am having to restart the whole system at the moment.
To restart the PHP
I am now running cherokee in debian. And i am using debian “sid” repo. But cherokee is suffering very much. after few hours every time it shows “504 gateway timeout”. Then i need to do /etc/init.d/cherokee restart to solve this, but after a few hours problem again arises. When i am out of my home, my site remains unavailable for this 504 … error.
Now i want to switch to nginx using this script. I read the whole script and tried setting up nginx and php5-cgi but failed.
How can i make use of this script on an running server like me and any help for sid repo ?
Great script!
I’m using 49 MB on Debian with 2 wordpress sites. amazing.
Where I can edit nginx .c files? I can’t find them.
Weird comment organization… these comment is placed over the 9/10 ones..
Anyway, the NGINX seems to be installed via respiratory (apt-get)
If you wish to edit them you’ll need to compile NGINX manually.
Hi LEA,
I use Debian 5 x86 VPS and install LowEndBox shell as this blog said. I could run WordPress and display static webpage very well.
However, if I browse a PHP webpage under /var/www/nginx-default folder by browser, the browser would download the PHP file, not display it.
Could you please tell me how to fix it?
Thanks!
LEA, maybe you have anything like fail2ban preconfigured for dropbear?
Nope, although fail2ban should be quite configurable to parse syslog file to catch the dropbear error message. I just haven’t really had a need to it yet as most my VPS have port 22 firewalled to specific IPs.
Here is the fail2ban conf for dropbear
Edit fail2ban jail conf
——————————————————————–
# vim /etc/fail2ban/jail.conf
——————————————————————–
bantime = 3600
findtime = 300
## Add dropbear jail at end of file
[dropbear]
enabled = true
port = ssh
filter = dropbear
logpath = /var/log/messages
——————————————————————–
# cd /etc/fail2ban/filter.d
# vim dropbear.conf
——————————————————————–
# Fail2Ban configuration file
#
# Author: Francis Russell
[INCLUDES]
# Read common prefixes. If any customizations available — read them from
# common.local
before = common.conf
[Definition]
_daemon = dropbear
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
# host must be matched by a group named “host”. The tag “” can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}:)?(?P\S+)
# Values: TEXT
#
# These match the unmodified dropbear messages. It isn’t possible to match the source of the
# ‘exit before auth’ messages from an unpatched dropbear.
#
failregex = ^%(__prefix_line)slogin attempt for nonexistent user (‘.*’)?from :.*\s*$
^%(__prefix_line)sbad password attempt for .+ from :.*\s*$
# The only line we need to match with the patched dropbear
# failregex = ^%(__prefix_line)sexit before auth from .*\s*$
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
——————————————————————–
Test fail2ban for dropbear
——————————————————————–
# fail2ban-regex /var/log/messages /etc/fail2ban/filter.d/dropbear.conf
@LEA,
Sorry again for a noob question. I changed the etc/hosts to point to my domain. How do I create a nameserver for it using the ip given? I just have one ip. For example, If I have to create 5 blogs, do I need 5 ips?
install bind/nsd3 dns server, you dont need 5 ip address, just use virtualhost.
Dont know anything about those or how to install them, but will google and try to find out.
Thanks a lot for the help.
check howtoforge.com :)
To create nameservers, you do need at least 2 IPs (though 1 IP would work by cheating). It’d be good to get a vps from another provider and set that up as secondary, and now you have redundant NS. :)
Err. Wrong answers.
Correct answer here: http://www.lowendbox.com/wiki/free-dns-providers
Pick one free DNS provider to serve your DNS, rather than doing it yourself with one single NS running on the box. I have used Zerigo and PointHQ both are of very high quality free service.
hey guys, any idea how to set dropbear to allow login using key authentication? i mean no password login, but pair of secret and public key. i did one before but using openssh, not sure how to do with dropbear, especially in this config. thanks. appreciate it :)
Hi, how can I change the limit of uploading file size,upload speed?
Two places that you need to change.
1. Nginx: client_max_body_size configuration parameter.
http://wiki.nginx.org/HttpCoreModule#client_max_body_size
2. PHP: Both “post_max_size” and “upload_max_filesize”
http://php.net/manual/en/ini.core.php#ini.post-max-size
http://php.net/manual/en/ini.core.php#ini.upload-max-filesize
I found there are two php.ini files under /etc/php5. Which one should I edit? /etd/php5/cgi/php.ini?
Yes. CGI one (rather than CLI, which is used when PHP is invoked on the command line).
This is great! How about adding a change to ownership of the new wordpress directory so that the plugin updates, etc. work properly:
chown -R www-data: /var/www/wpdirectory.com
No. Files shouldn’t be owned by the same owner as the web server. They shouldn’t be owned by root either (my script is a quick hack but you do need proper users). Files owned by web server means they can be overwritten by web server or your PHP process, if there’s a security breach…
Does this mean I should the ownership of the files to www-data on the server and the sites will still work without problems or any further work?
Sorry – I didn’t read that correctly. What should we do to secure our files and server then?
My principle is web server + any script environment (PHP for example) should not have write access to anything other than the ones you intend. For example PHP FastCGI processes should not be able to write to any PHP files. It should probably only be able to write to upload directories, which then need to be excluded from PHP execution…
Way too much to cover in terms of security.
I’ve done a similar installation, instead I’ve used PHP-FPM and Linode VPS. I’ve also written a step by step tutorial on it so that other people can get help with installing Nginx & WP together:
http://tutspundit.com/howto-install-nginx-php-fpm-mysql-php533-wordpress-ubuntu-part-1/
非常好.收藏了.
I modified a script called lnmp to use new version of nginx it installs
* Nginx 0.8.53
* PHP 5.2.14 ( Didn’t updated it to 5.3.x because some web scripts reported to be having problems with 5.3.X branch)
* Mysql 5.1.48
* PHPMyAdmin 3.3.7
* Eaccelerator (optional 1 click install)
* VsFTPd, PureFTPd (Optional 1 click install)
* PHP Suhousin Patch
It uses about 80MB of ram with 4 worker processes on my own site http://www.ruchirablog.com
Additional details of installation can be found here http://www.ruchirablog.com/nginx-autoinstaller/
Why is it that the content reminds me of some other identical the one which I just read elsewhere?
anyone know how to enable ipv6 in nginx?
–with-ipv6 option if you compile NGINX yourself.
Not sure whether it’s enabled when you get it via apt-get.
to check this just run
nginx -V 2>&1 | grep –color=auto with-ipv6
While testing sime things for a buddy, I had the chance to run the script on a fresh 256MB cloudthing at rackspace cloudserver setup with the debian image they offer.
Works w/o problems.
On the debian part I needed to install locales and dpkg-reconfigure them.
hello~i used lowendbox nginx php mysql;
can you help me to set rewrite for wordpress wp super cache?
http://xenbox.net/what-new/ngix-wordpress-wordpress-super-cache/
you can use this config
I had to do the wget line as this:
wget --no-check-certificate http://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
Kept complaining about the cert not matching. Didn’t look into fixing the problem. Just wanted to get the file.
Yeah. Due to recent Firesheep controversy github has moved everything to HTTPS. Looks like they are using a GoDaddy wildcard SSL to cover *.github.com, which does not actually work in the case of github.com.
LowendAdmin, this script is still broken on Ubuntu. PHP will not start up after a reboot. I have tried 10.04, and 10.10. Please fix the script, as it only works properly on Debian (except the WordPress installation, that is broken on Debian, I have to manually create the folders)
tested today on debian lenny and everything (needs the –no-check-certificate) works fine, included wordpress setup.
maybe a small improvement would be to add the option to install an updated nginx version
http://wiki.nginx.org/InstallingFromDebianRepositories
Hey, thanks for this script. I’m new to the whole low end box thing and this helped me figure out how to get PHP working with nginx nicely (though I compiled nginx from source for newer features). Debian 5 32-bit with Drupal going is humming along at 42MB. I didn’t know it was possible to install Drupal without a gig of RAM.
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
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?
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.
Would you mind if I used a few parts of this script for another, similar project under the GPLv3 license?
Feel free to clone it on Github. GPLv3 is okay.
This script is pretty terrible. The only thing it has accomplished is helping many clueless people to set up a highly insecure VPS.
@Ryan :
Then, would you please post your script here, and explain how it works. And help this many clueless people for getting smarter.
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.
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.
how to add name sserver.. like a ns1.domain.com on our site?
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.
Just upload/download it to the VPS server, extract and off you go.
upload phpmyadmin?
where do I find it?
thanks.
phpmyadmin.net
Thanks Jack,
where to install? which directory? Can I SFTP it?
is there wget command for this?
Thanks so much.
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.
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.
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.
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. ;-)
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.
just one more q,
i set up pma but what username and pass do I use?
I tried my root but no luck.
Thanks.
nevermind, got it.
thanks a bunch
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?
When making changes to Nginx you’ll need to restart it.
/etc/init.d/nginx restart
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.
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!
Thanks for that info.
What are benefits of 4 processes? is it better for multi-site VPS?
Thanks.
Would also like to know about this.
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!
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!
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 ;-(
With more processes php will have less load and will avoid hanging out by trying to serving many requests with one worker process.
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.
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 .
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.
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.
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]
my code tags messed up! :P
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.
LOL at the date post…
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.
Why not a Google?
http://lmgtfy.com/?q=nginx+www+non-www+rewrite+rule
Nobody?
Since Googling is apparently so hard, here you go: http://techtitbits.com/2010/07/wwwno-www-rewrite-rules-for-nginx/
Why not use a HTACCESS Redirect.
You could also do server_name http://www.mydomain.com mydomain.com;
.htaccess does not work on nginx
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 ;-(
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.
Look at the LEB man! Its running fine without any problems nginx is damn stable than apache or lighttpd with my experience!
And if you want to view my uptime info with LNMP RB http://www.ruchirablog.com/uptime.php
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.
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
Hey read the text, run the following command instead:
wget --no-check-certificate http://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
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?
Please wait for tut from LEA :D
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'
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 ;-)
thanks for the update nginx
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?
Was the previous ram usage with pageloads? Because after loading a couple pages with the stock nginx, it would use about 50mb or so.
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.
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.
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.
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.
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 ;-(
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…
anybody?
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?
Thanks for taking time to reply,
What do you mean by “low i/o”
Run a test:
dd if=/dev/zero of=/home/test bs=64k count=512 oflag=dsync
Then post your results.
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…….
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.
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.
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
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.
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)
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.
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!
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.
it is max_children
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.
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! :)
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.
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-ToolAgain 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 :P 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!
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 ;-(
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.
Well, what is your budget to get that 5 machines? :P
And what location and requirements :P What are your I/O needs? There are a lot of companies :D
Because as always, YMMV, and everybody have a different experience.
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).
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]
:)
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
Yes, that was another one that gets mentioned quite a bit on the web (when Googled for nginx last week)
Thanks Ruchira.
I really wish they start accept paypal :(
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?
use memcached! EAccelerator wont whelp you!
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.
how do you installed memcached? and whats your OS?
I believe it was enabled automatically (using your script)
if not I probably used apt-get install (this is on Debian 5)
Thanks
Fresh Ubuntu 10.04 32 bit installation with an empty wordpress blog:
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?
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.
Use this command to resolve the problem
source /etc/environment
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)
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.
can anyone tell me how to write re-write rules for WPMU,both sub-directory and sub-domain,at nginx conf?
We talked about it here although it’s just for subdomains:
http://premium.wpmudev.org/forums/topic/nginx-rewrite-rules-with-wpmu-wp-super-cache-bbpress-and-sitemaps
That`s great tutorial
Will check against my own configuration.
Oh, poo. I;m getting a “Distribution is not supported” error when I try to run this on Debian 5.5. :(
Damn I’m tired. Never mind. I was looking at a Putty window opened into one of my FreeBSD boxes. Maybe I can get the top bar into a different color or something like that.
FreeBSD support coming soon… NOT! :)
should update to debian 6 as well. in case there’s a need of adjustment
:P FREEBSD FOREVER! :)
Serious question since id mentions 6.0 and I just realized that it was available. Will this script work on a 6.0 install?
I thought you was a Linux User xO
Who me? Nah, the servers are all FreeBSD. I came up on main and miniframes and feel more comfortable with it. The 2 offsite VPSes that we use for secondary DNS are Fedora CPanel installs. Those are managed though so I never look at them. The XServe Raids we have are Mac OS which is some form of Linux but those are managed as well.
Mac OS X is based on BSD.
Is it? I thought it was Linux. Hmmm….
I never come down to the command prompt on those boxes. I always screw something up.
My upgrade to Debian 6.0 just failed with lots of errors and failed installs. Using this walkthru:
http://www.go2linux.org/how-to-upgrade-from-debian-lenny-to-squeeze
If anyone has one better….
Darwin, Mac OS kernel is based on BSD and the others.
en.wikipedia.org/wiki/Darwin_(operating_system)
“Darwin is built around XNU, a hybrid kernel that combines the Mach 3 microkernel, various elements of BSD (including the process model, network stack, and virtual file system),[5] and an object-oriented device driver API called I/O Kit.[6]”
Just to mention, running “apt-get update” and “apt-get upgrade” after doing all that is a plus. Came back with 40 upgrades after doing all that.
Thanks again by the way. Probably be lost without this. Either that or I would just install FreeBSD and say the heck with it. :)
Its not working. please check this:
Please help me :)
Do as it says… Add –no-check-certificate to wget.
wget –no-check-certificate http://github.com/lowendbox/lowendscript/raw/master/setup-debian.sh
Should work :)
I think something went screwy with this script after upgrade to squeeze. I had a fresh reload of lenny on a quickweb vps, ran apt-get update, then upgrade, then dist-upgrade, then ran this script. Had some issues with the mysql install and php doesn’t want to play with nginx.
I’m poking around to see what I can find …
@raj – using squeeze you can add to your sources.list
deb http://packages.dotdeb.org squeeze all
deb-src http://packages.dotdeb.org squeeze all
so you get updated nginx and php. But maybe it’s time to open a LET discussion with improvements and suggestions for a new version of the script. BTW i tested the script on new squeeze box and i had troubles too, but i didn’t investigate too far
install seemed to go fine, but a pph file doesn’t get parsed, it just downloads.
What went wrong? php is running
ps: i am trying to tun php on de the default page, maybe that explains it
So is it just me or is this not working anymore?
I followed the instructions but my php doesn’t work.
I would check your box setup, script still works great.
Does this script handle ipv6 enabled VPSes? Meaning will nginx listen on both ipv4 and ipv6 with this script?
And any links on a “lowend” FTP server to add to it?
Nginx by default listens on all interfaces.
I used to use Pure-FTP for those who insist on their insecure and inconsistent protocol. Haven’t done that for the last 3-4 years :P
Anyone know how to get dropbear to listen on ipv6? Just cant figure it out..
I am having a problem with bash setup-debian.sh exim4
Starting MTA: exim4.
ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken … failed!
Setting up exim4 (4.72-6) …
Setting up libdb4.7 (4.7.25-9) …
Setting up heirloom-mailx (12.4-2) …
update-alternatives: using /usr/bin/heirloom-mailx to provide /usr/bin/mailx (mailx) in auto mode.
Setting up psmisc (22.11-1) …
Setting up perl-modules (5.10.1-17) …
Setting up perl (5.10.1-17) …
update-alternatives: using /usr/bin/prename to provide /usr/bin/rename (rename) in auto mode.
exim4 installed for mail
Stopping MTA for restart:.
Restarting MTA: exim4.
ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken … failed!
I think this may have something to do with inetutils-syslogd.
Any help would be much appreciated.
Exim was setup sucessfully.
Try to remove the paniclog file and start exim.
Maybe the process was killed for the OOM manager…
Also, you can check the contents of the logs for exim… mainlog and paniclog to see what happenned.
I setup new website using lowboxend’s package successfully.But it’s no reponse to upload a new theme in wp-admin.What happened to this? Would you help me?
Do you see any advantage to install “daemonize” in order to “start the PHP process and disconnect it from the shell” as said by dmmcintyre3 at freevps.us forum (https://freevps.us/thread-60.html)? Notice that the tutorial was originally ment to run via yum.
I ran basically everything, but the wordpress thing, and when I had gone into:
/var/www/nginx-default, and edited the index.html
to become this:
PHP Test This is an HTML line
And I cannot see anything, but a blank page.
I don’t think that my PHP with nginx is working, as when I had opened it (nano /etc/nginx/nginx.conf) it had only contained the following:
================================================
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
=====================================================
So I’m not sure, as I am a newbie.
All the help will be appreciated
Debian 5.0
Look at the line:
include /etc/nginx/sites-enabled/*;
It means after reading this config file, look in the sites-enabled folder and load any of those config files. You should find a file like yourdomain.com.conf
Open that and edit the settings there.
I found my websitename.conf, but when I open it (with nano)
it’s just an empty file.
Using the modifyed script on http://freevps.tk/downloads/setup-debian.sh which basicly gives the functionality of adding virtual servers without wordpress, I also installed on a Debian 5:
rsync, sshfs, subversion, memcache and APC.
Then, I set up 3 domains and 3 subdomains serving static HTML files and dinamic PHP files. After all, I experimented the cleaning memory tips on http://www.w3bnet.com/freeing-linux-virtual-memory/
This is what I got after loading every single page of every domain instaled on the VPS 10 times:
hv1:/proc/sys/vm# free -m
total used free shared buffers cached
Mem: 250 28 221 0 0 10
-/+ buffers/cache: 18 232
Swap: 494 0 494
I forgot to say that I am using google appspot as a CDN and I am using base64 to embed some files into the HTML file.
By the way, the HTML file has 92.3 KB (92 KB from cache) and is taking 1.03s (onload: 1.26s) to load. Nothing bad for a VPS under US$10.
Interesting that drop_caches stuff. But it seems useless, because the cache helps to get performance.
Also, can’t be used in opneVZ containers u_u
I forgot: this is how the brand new Debian 5 was just before any optimization or instalation:
root@ds:/# free -m
total used free shared buffers cached
Mem: 2048 34 2013 0 0 0
-/+ buffers/cache: 34 2013
Swap: 0 0 0
It is just not working for me.
I tried to change the /sites-enabled/default, to point to my WordPress directory, and it worked, but as you can see.
It showed all the wordpress PHP code.
So I then edited this default file to have the PHP stuff, did it correctly.
and when I go to visit my website it gives me that the page is temp. unavailible.
:S
Why isn’t anything going right with me?
hi, i know you said this tutorial is for advance user, but i like it and it uses a lot less memory than anyone else i found so far…i am a newbie, so here goes, i install everything on Ubuntu 10.04 and it works…my server main ip is 74.63.214.218 , i have rj519.info pointed to my server ip..it works, i get “welcome to nginx” . questions? i install rj519.info with wordpress already ,so how do get main ip and rj519.info both goes to same wp install? i have been on this googling 3 days and cannot figure this out…any help would be appreciated…thanks….ps can you reply to email….thanks..
Very great tutorial. Thanks so much
Script appears to work fine for Squeeze Debian.
Spoke too soon:
mv: cannot move `/tmp/wordpress.3289/wordpress’ to `/var/www/cynix.us’: No such file or directory
chown: cannot access `/var/www/cynix.us’: No such file or directory
cp: cannot stat `/var/www/cynix.us/wp-config-sample.php’: No such file or directory
sed: can’t read /var/www/cynix.us/wp-config.php: No such file or directory
Reloading nginx configuration: nginx.
Looks like they moved things around on Debian 6.0:
http://www.codernotes.com/2011/146/nginx-default-root-directory-on-debian-6-squeeze/
Turns out actually /var/www/ didn;t get created. Not sure if that’s an issue with the script or Debian 6.0 or some gremlins or the phase of the moon but that’s the issue. Worked fine after I created the directory.
LEA, can we add this point to the instructions up there?
Thanks
I want to upgrade the nginx but I do not know how to do it?Can you give me to advice?
Some specifics would be helpful. The versions you;re using, the OS, what’s stopping you from upgrading, etc.
I follow this tutorial above!!!
use debian 5
neginx version is 0.6.32
php version is 5.2.6-1+lenny9
I want to upgrade all of them
The tutorial above makes no mention of upgrading. This is why I asked you specifically as to what you’ve done.
Again, you need to tell us what you’ve done and what’s stopping you from doing so and/or what error you’re getting.
I have no error to get.I only want to upgrade the version of nginx and php
I think the version are too low
and I want to test nginx version 1.0.0
subbed
I got an error
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
Ok, So I really was hoping I wouldn’t have to ask this question on here. I did all the steps and setup wordpress as domain horizonschurch.net. I only plan on having a one website setup. Is there a easy way to configure this so that when I goto just the IP Address I can see the site. I am wanting to do some testing before I actually flip the site over in the @ records of my domain. I am not needing multiple virtual hosts basically.
is this still working?:D
Absolutely!
Yup, just see my note here:
http://www.lowendbox.com/blog/wordpress-cheap-vps-lowendscript/#comment-31328
Thanks! Will check and I will try this =D
So I edited the php.ini file for allow fopen(), but WordPress Jetpack is still giving me a error. I restarted the php service and checked the php.ini file in the cgi folder. Can someone help me with this?
Not unless you tell us what the error is. :)
Jetpack could not contact WordPress.com: register_http_request_failed. This usually means something is incorrectly configured on your web host. Could not open handle for fopen() to https://jetpack.wordpress.com/jetpack.register/1/ is the error thanks for looking into it.
can any1 tell me how to install SUPHP with this script?
Hmmm, SUPHP doesn’t go with Nginx AFAIK…
hey LEB admin, how to enable php curl with this script?
thanks
apt-get install php5-curl
???How do I change the port that dropbear listens on? and also disable root logins?
I edited the /etc/default/dropbear but did not help after reboot.
Thank you. This script rocks!
In the example I used xinetd to invoke Dropbear. See this discussion thread on LowEndTalk.
lol. 80 MB vps and running wp? i can’t imagine that.
how about max visitors in a time ?
my old server even with 1GB RAM, can’t handle more than 50 visitors in same time.
Thanks, LES, :)
I made my own script using this post for centOS, works great.
@rev,
Got WP work with 150 concurrent connections w/o problem on buyvmOVZ128.
Sorry for the stupid question, but what happens when the Linux OS uses all the available RAM (and also SWAP)? Does the system erases data from RAM in order to save new data? Using this same scenario (all RAM was used till the last bit) what about the cache systems like APC and Memcache/d? Do they help to make this “memory administration” or do they mess it up?
I’m not too sure with the technical details behind it, but I believe it should start taking away from your inactive memory (memory that has been allocated to programs but not currently in use). After you’re completely out of RAM and swap that the system can use, I’m not completely sure. On some VPSes, it’ll actually just start killing processes, but I’m pretty sure that’s the virtualization software and not the operating system itself running on the VPS.
This is just what I’ve heard over the years. I’ve never had any of my servers or computers have no memory left, but like any one could assume, I’m sure it would be extremely slow as your system would be relying on swap memory (that is, if you have any).
So it’s not a stupid question after all :-)
I have 4 HTML/PHP small websites and 2 WordPress installations running on a 256 RAM VPS and this is what I get:
free -m
total used free shared buffers cached
Mem: 246 243 3 0 1 12
-/+ buffers/cache: 229 17
Swap: 487 230 257
Recently, I turned APC and Memcache/d off just to see if the would be some RAM economy but the memory went up in the same way it did before, when the cache systems were on.
From what I can tell, the sites are running fine…
For example, atipico.com.br and casachile.com.br
Nope, not at all!
If the memory is going way up, I’d check on what is is. Take a look at top (or even htop) and see what process is hogging all your memory. I’ve seen PHP spool up a ton of processes, and it made my VPS use quite a bit of memory. Then again, I’ve seem Apache take up a ton of memory as well.
This caching systems aren’t to reduce RAM consumption, instead, are a tradeoff to get better performance sacrificing some memory.
I took a screen shot of htop and put it here: http://imgur.com/P0E8W
This shows a lot of PHP-FPM processes running. As I was not able to configure this Linux Box to run PHP with the built in CGI, I had to use FPM. And it looks that I am allowing to many FPM processes to run, isn’t it? All the rest is quite irrelevant, I think.
I’m using Nginx and PHP5 (FPM) as well, but PHP isn’t use as much memory as yours (http://grab.by/grabs/8286866316c5efcf61abb3ef1bbe3e4f8d6ba09716.png). In your “php5-fpm.conf” file (at least on Debian Squeeze it’s in /etc/php5/php-fpm.conf), add in the follow to the document.
pm.max_children = 10
pm.start_servers = 3
pm.min_spare_servers = 2
pm.max_spare_servers = 5
pm.max_requests = 500
I use a bit higher values, as I’m not on that little RAM, but I’m guessing these values should keep PHP running nicely for you. :)
*following… sorry for the grammar mistake.
Good point, thanks.
I could access mu PHP-FPM conf file in Debian 6 with:
nano /etc/php5/fpm/pool.d/www.conf
The default values were:
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
;pm.max_requests = 500
My question is: why not turn:
pm = static
pm.max_children = 4
as recommended here: http://www.codernotes.com/2011/7/install-nginx-and-php-fpm-on-debian-6-squeeze-2/
By the way, the bootstrap scrip recommends: “php with built-in FastCGI interface. Running only 1 child process and respawn after 5,000 requests.”
Yes, it seems that you are running a lot of PHP processes, you need to configure that in the startup script of PHP.
Also, that memcache daemon, are you using it? And you need xinetd? I see that you are running dropbear.
Btw, configure htop (F2 key and then display options) to hide threads.
I was running the default PHP-FPM conf. I’m taking care of it. About memcache, yes, I am using it, but very, very rarely.
About htop, I didn’t quite understand for threads was already marked to be hidden; I deleted the print screen, just in case.
About xinitd, it is included in the original bootstrapping setup-debian.sh:
function install_dropbear {
check_install dropbear dropbear
check_install /usr/sbin/xinetd xinetd
# Disable SSH
touch /etc/ssh/sshd_not_to_be_run
invoke-rc.d ssh stop
# Enable dropbear to start. We are going to use xinetd as it is just
# easier to configure and might be used for other things.
cat > /etc/xinetd.d/dropbear <<END
service ssh
{
socket_type = stream
only_from = 0.0.0.0
wait = no
user = root
protocol = tcp
server = /usr/sbin/dropbear
server_args = -i
disable = no
}
END
invoke-rc.d xinetd restart
}
About the first, the kernel uses the OOM killer http://linux-mm.org/OOM_Killer
About the second, APC “saves” temporarily the compiles PHP code, and then your PHP process doesn’t need to recompile every time that someone does a new request, and instead it server the cached webpage.
Memcache is different, because it runs as a daemon. Is a kind of database to mantain values in memory instead of going again to your database to request them.
So, in a way, it’s good to have APC and Memcache/d working together for they will help to manage the flux of data in the RAM, is it?
APC has a seamless integration. Memcache requires to implement the caching routines in your application.
Yomero, would you use APC in a VPS in a case like mine (4 html/php small sites + 2 wordpress sites)?
It seems that you are in a 256MB vps. I am afraid that you are running out of RAM. Using APC probably will help, but probably will be worst if you start to swap even more. First try to reduce your RAM usage, and as everybody recommends here, use Nginx if you can
Gracias, Yomero. I am already using Nginx and, except for the fact I am hosting 6 small websites, I followed all the steps recommended here. Is it possible that these two WordPress installations I am running is indeed using double the memory a single wordpress installations would do? If so, I guess that making use of the Multisite feature is the only way… (or would multisite use double the memory anyway?)
You can host 10000 sites without problem, the memory usage will be the same, I think is independent of WordPress. The problem will come if you get a lot of visitors and your PHP processes can’t be enough fast to serve all the requests.
So, no matter how many wordpress I have installed in that box, the big problem will be to determine the “expenses” of serving the requested pages, in the case of a high volume of visits. To accomplish this task, APC plays an important role I think. As far as I can see, by determining only one chield to run and “the number of requests each child process should execute before respawning” to 5000, the bootstrapping script is really counting on the processor, isn’t it?
That is the idea, a lot of requests to the same content -> APC will kickass xD
Ahm, I have done almost nothing about serving web pages, but I think the number of PHP processes is related to the number of cores that you have available. Probably 2xCore is a lot, maybe 1 or 1.5xCore is a good choice.
About PHP-FPM, is a fork designed to spawn and kill dinamycally depending on the number of requests. Putting a “static” flag will disable this feature (I think). So, PHP-CGI (the normal implementation) is a good choice for little servers.
Something continues very wrong here.
After changing the PHP-FPM conf file in Debian 6 (/etc/php5/fpm/pool.d/www.conf) with the follow:
pm.max_children = 5
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 2000
And turning on APC again, this is what I get from “free -m”:
Immediately after reboot:
total used free shared buffers cached
Mem: 246 102 144 0 3 53
-/+ buffers/cache: 44 201
Swap: 487 0 487
After a day of using the server:
total used free shared buffers cached
Mem: 246 229 17 0 24 135
-/+ buffers/cache: 68 178
Swap: 487 0 487
In brief, only 17 MB are free… I’m thinking about two options: limit somehow the memory APC can use and turning the PHP-FPM pool from “pm = dynamic” to “pm = static”…
Any suggestions?
It seems that you are misunderstanding how to read the “free -m” data:
In the first case you have 201MB free, in the second 178MB (Very big improvement, because previously you posted an output with only 17MB free)
http://www.linuxatemyram.com/ Hope that helps you to understand
Muchas gracias!
By the way, is there any Mysql cache system (like APC for PHP) that would be recommended to use in a VPS?
There’s query cache (and table cache) built right into MySQL. As for a dedicated piece of software, I’ve never heard of one before…
Mysql has is own caching system to reduce the I/O load for reads/writes, and is configurable in the my.cnf file.
The script is already tuning my.cnf file (putting everything in the processor backs):
cat > /etc/mysql/conf.d/lowendbox.cnf <<END
[mysqld]
key_buffer = 8M
query_cache_size = 0
skip-innodb
END
Anyone have any luck installing AWSTATS or equivelent on this setup?
Not sure why but I’m having to manually install exim4. I could have sworn that I had installed it during the initial run through on the script.
When I rerun the command, it tells me that it’s installed already but a updatedb/locate for exim doesn’t find anything. Doing a “invoke-rc.d exim4 restart” like you have in the script gives me an “unknown initscript, /etc/init.d/exim4 not found” error.
I think I’ve managed to fix all the PHP restart problems people are having. First an explanation. Ubuntu deletes the contents of the /var/run folder upon reboot to ensure smooth operation, the way I fixed this was to add a line to the init script.
Solution, create a new line in /etc/init.d/php-cgi after line 40:
Hope this helps!
If this is the wrong way of accomplishing this please let me know. LEA, thanks for making your script public, would you consider updating your install script with this change? It would save us Ubuntu users some pain.
maybe a tut on installing whmcs. and vbulletin like this? nice to hear back about it.
after some day of messing up, this is THE solution for noob like me… i would like to learn more about this… starting understanding your useful script!! thanks
I get this, Starting to bug me…
mv: cannot move `/tmp/wordpress.3912/wordpress’ to `/var/www/blog.b00d.com’: No such file or directory
chown: cannot access `/var/www/blog.b00d.com’: No such file or directory
cp: cannot stat `/var/www/blog.b00d.com/wp-config-sample.php’: No such file or directory
sed: can’t read /var/www/blog.b00d.com/wp-config.php: No such file or directory
Reloading nginx configuration: nginx.
Why you have a wordpress.3912 folder?
In the script where WordPress is setup, it uses the process ID to create temp folders (common shell programming practise).
After having good performance with QuickWeb, I want to move my blog to BuyVM because they have IPv6 working by default.
So, if I visit my IPv4 (209.141.48.45 ), it show’s my blog. But when I visit my IPv6 ( shows2607:f358:0001:fed5:0009:0000:0758:001 ), it shows “It works”.
I am running Debian 5 32bit with BuyVM. Is there something I need to modify to display the blog by visiting my IPv6?
Type “nginx -V” to check if installed version of Nginx supports IPv6. “–with-ipv6” should be under configure arguments, if not you have to recompile Nginx with “–with-ipv6”. Then just add “listen [::]:80 ipv6only=on;” to .conf files in /sites-enabled/.
I am using the default NginX with this script. So maybe it’s the 0.6.32.
Maybe i will just compile it with the new one then.
Thank you :)
This could help you: http://kovyrin.net/2010/01/16/enabling-ipv6-support-in-nginx/
Thank you for the link :)
I’ve doing some google search, and also found that link.
I am using this script but I can’t get wordpress to connect to wordpress.com with Jetpack plugin.
How could I solve this issue?
Here is an error.
Your website needs to be publicly accessible to use Jetpack: site_inaccessible
Error Details: The Jetpack server was unable to communicate with your site [IXR -32300: transport error: http_request_failed Operation timed out after 15001 milliseconds with 0 bytes received]
Just in case someone has the same problem.
I need to change PHP_FCGI_CHILDREN from 1 to 2 and it solves the problem.
Hey LEB admin, does this website still run with the same 80 MB RAM specified in the post or have you upgraded? Because im planning to buy a VPS & your answer would help me.
No it has been upgraded to 160MB of RAM
I am using this script on Rackapace Cloud Server. I pay about $12.00 a month for 256MB ram.
Once thing i’ve learned is Ubuntu 10.4 with PHP 5.3 is terrible. WordPress has issues and with running W3 Total Cache, my Googlepage speed was down to 79.. Switching back to Deb 5 Lenny, PHP 5.3.6 and Lighttpd with W3 Total Cache, my pagespeed went back up to 98..
I would avoid Ubuntu and php 5.3 unless you really need it. Drupal and other softwares are not fully supporting php5.3 yet from what I read.
Chris
Ick.. I meant Swtiching to Deb 5 with Php 5.2.6 fixed all the issues.. I can’t spell and no edit either.. oOo
Good script to use for WordPress. Consider upgrading Nginx to latest from source.
Script works beautifully! Thank you so much!
How to enable FTP for installation of wordpress themes automatically?
Thanks.
Try installing libssh2-php, reload php-cgi and use SSH rather than clear text FTP to install plugins / themes automatically
Is PhpMYadmin not necessary?I dont see it mentioned here.
Also how to update the nginx or other packages after installing this script?
Would request you to post an updated version, as many seem to use this script.
phpMyAdmin is not necessary as it can be installed after you use this installation script with “apt-get install phpmyadmin”
You update the packages and nginx by using the update command within your operating system since it uses operating system packages, not compiling from source. If you are using a Debian or Debian based Linux operating system like Ubuntu, you do this with
apt-get update && apt-get dist-upgrade -y
This will fetch the updates and see if your distribution needs an upgrade.
Here are some configurations I found for php-cgi to use standard rewriting, or to use Super Cache or W3 Total Chace as well. http://kbeezie.com/view/nginx-configuration-examples/
Saving that link NOW!
Probably I will need to move a big wp from Apache
Here are some more low resource usage scripts with up to date software for CentOS.
http://centminmod.com/
Centminmod is based on the script by btcentral below.
http://www.btcentral.org.uk/projects/centmin/
Chris
ok, that’s all great, but no one did not said if he/she is actualy using this, and how much visitors per day could 128 MB RAM VPS take before it goes into serious problems? If someone yould answer that… Thanks :)
It really depends on what you’re running.
Hi, just one wordpress instalation with 2 simple plugins, and firewall plugin
Ok, and from which provider?
On WordPress on a really slow vps (1 Pagegeneration per second) you could have about 60k – 80k hits per day… I think that is more than enough!
OMG, i didn’t think that this is possible. I will definitely give it a try. Thanks.
Ahm, that is possible! And that is only for the badest vps I ever had…
If you want more details for optimazing & co, give me a mail address :)
I was looking at http://buyvm.net/ i was told that they ere reliable
Hmm, they’re mostly okay – but I never tested a wordpress performance check on them.
I would take one from Edis, XenVZ, or SecuredSpeed – the problem on buyvm is that you will have problems to order one… :P
Yes, i saw that they are out of stock, i’ll wait, or i will look for other cheap VPS
Write me a private Message on LowendTalk, maybe I could do something for you ;)
-> http://www.lowendtalk.com/profile/Amfy
is there any installation guide for beginner, like me. it’s so difficult
Thanks a lot for this ! Everything worked out fine on debian6. I only had to chown -R the /var/run/www/site-name after because it seems it didn’t work at the set up.
Am getting only “Welcome to nginx!” on index, and 404 on wp-admin.
But on the same VPS, I had installed WP with this script successfully on the same OS (32bit Debian and Ubuntu). Since it is only 4 commands, I can’t seem to figure out what exactly I did differently. Perhaps something on the provider’s side has changed.
Any pointers on how to fix it?
i’m facing an issue, after bash setup-debian.sh wordpress blog.example.com i opened blog.example.com on Browser and its loading blog.example.com/wp-admin/install.php
After that i installed phpmyadmin using apt-get install phpmyadmin
Now when i’m loading host.name.com/phpmyadmin or server.ip/phpmyadmin its redirecting to host.name.com/wp-admin/install.php to the url and giving error Oops! This link appears to be broken.
though host.name.com is loading “Welcome to nginx!” correctly.
any ideas?
Set up fine, however I have an issue with having more than one domain on my VPS.
bash setup-debian.sh wordpress domain1.com
That works, and when I visit “domain1.com” it works. When I visit the IP address of my server directly, I also see the content for ‘domain1.com’
bash setup-debian.sh wordpress domain2.com
I just added this domain, but when I visit it I only see the content from domain1.com. I can confirm that /var/www/domain2.com has been created.
I’m using Cloudflare for my DNS, if it matters. What do I need to do to my vps config so that I can have more than 1 site hosted on it?
I’m running that command to create 3 domain hosted in a BlueVM VPS and it works.
Maybe your problem is with the CloudFlare. You can try to disable it and try to visit it again.
If I disable Cloudflare, how would I access the site? I use Cloudflare for my DNS.
Create an A record for your domain to your VPS IP.
Ah, it just started working all of a sudden. But now I have another issue.
I’m not using the second domain for a WP blog, it’s for a static html site. I just set it up with this script as it was easy, and I can just remove the WP files after. I removed the index.php page as a test, and replaced it with my own index.html page.
http://www.domain2.com returns an Nginx error. http://www.domain2.com/index.html shows my page. Why is that? I looked at the nginx.conf file as well as the .conf file located within /etc/nginx/sites-enabled/ dir but I can’t seem to get it to load index.html files.
@CM, try the ‘/sites-available/default’ or /sites-enabled/default’.
There should be a block labeled ‘location / { }’. Make sure index contains index.html.
For Debian 6 Need to :
mkdir /var/www
then after installation
chown -R www-data.www-data /var/www/{Name of wp}
You can grab an updated fork for Debian 6.
Works very well on BuyVM’s Debian 6 template.
Please read the readme file before installing.
@Simplyfast
How do I get phpmyadmin to work with that? When I install with apt-get install phpmyadmin, I get prompted to use apache2 or lighttpd.
This setup works very, very well.
Just rolled it out to 5 different servers.
Thank you for the great work.
Here’s result on my SSD VPS, 256 MB, Debian 6 32bit
It would be nice to see this script using PHP-FPM instead of PHP-CGI..
I coded a Bash script that uses dialog for the selection of packages, kind of tasksel but fully tweaked.
It works with either Ubuntu or Debian. If anyone wants to have a look, it’s available at GitHub.
This is amazing … I’m using it on a 2gb vps that was just provisioned in LA and it is almost done. Can I please ask if you can add more utils to it like Drupal / WordPress / Joomla / ffmpeg. Thank you.
I can’t use this script on Godaddy Cloud Server.
Once you have the vps all set up, I would suggest setting up a free monitoring tool such as Got Site Monitor to keep an eye on the performance and uptime of your vps.
Awesome!.
Works perfecly for me, in a 128MB RAM VPS that was getting me crazy with apache and mysql.
Thanks a lot.
Amazing!
Thank you very much for sharing your scripts?
I couldn’t figure out how to make it work on my 128 vps.
With your script and debian 6 vps openvz it worked!
Before mysql was always crashing badly (not enough memory allocation)
Perfect now because of you
Thanx again
Thank you, your script is very useful!
is this working in Ubuntu 12.04?
i get mysql error
thanks a lot
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)
$- service mysql start
start: Job failed to start
Hi.
The syntax for disabling innodb (used in this script) is deprecated.
There is an easy fix for this though:
1. Open /etc/mysql/my.cnf in your favorite text editor. In my case,
# vim /etc/mysql/my.cnf
2. Find and remove “skip-innodb” and replace it with
innodb=OFFdefault_storage_engine=MyISAM
3. Restart the mysql service.
# service mysql restart
I found this fix here at ServerFault. This also solves the “Starting MySQL database server: mysqld” error.
Hope I helped someone (even after a year has passed!)
Correction:
In your /etc/mysql/my.cnf file,
Find and remove “skip-innodb” and replace it with
innodb=OFF
default_storage_engine=MyISAM
failed in bash setup-debian.sh mysql
mySQL not running
invoke-rc.d mysql start
[FAIL] Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
invoke-rc.d: initscript mysql, action "start" failed.
1. cd /usr/bin/
2. sudo ./mysql_install_db
Hi,
I used this script to set up my 256 VPS. I modified the script to not install dropbear as I have had trouble with it in the past. That’s not really related to my question though.
I have two problems.
Currently I have nginx up and running fine for serving static pages. However, PHP isn’t working. When I try to access a php file it just shows the plain text of the php file.
Secondly if I try to access a subdirectory from my web root it does something weird where it redirects to localhost. For example: if I try to access example.com with an index.html in the web root it works fine.If I try to access, say, example.com/dir1 which also has an index.html inside my browser shows it redirecting to localhost/dir1.
Any help would be appreciated.
/etc/nginx/sites-available/default : http://pastebin.com/7Le0SjBa
/etc/nginx/nginx.conf : http://pastebin.com/pSUEKmkB
Any help would be immensely appreciated!
Oh, I’m on Debian 6 if that is relevant.
How to change the domain”blog.example.com” to another domain? And I run /etc/nginx/sites-enabled/domain.com.conf,it say”..line 1: server: command not found” and more command not found info.Thx!
Great beat ! I would like to apprentice even as you amend your web site, how can i subscribe for a weblog site?
The account aided me a acceptable deal. I have been tiny bit
acquainted of this your broadcast provided vivid transparent idea
Do you mind if I quote a few of your articles as long as I provide credit and sources back to your weblog?
My blog site is in the very same niche as yours and my visitors would truly benefit from a lot of the information you present here.
Please let me know if this ok with you. Many thanks!
Have some package changes stopped this script working?
seeing issues with Mysql on Debian 5, 6 and Ubuntu.
# bash setup-debian.sh mysql
mysql-server already installed
mysql-client already installed
Stopping MySQL database server: mysqld.
Starting MySQL database server: mysqld.
Checking for corrupt, not cleanly closed and upgrade needing tables..
mysqladmin: connect to server at ‘localhost’ failed
error: ‘Access denied for user ‘root’@’localhost’ (using password: YES)’
Mysql 5.5+ needs this added in setup-debian.sh, in the “install_mysql” function where it creates “/etc/mysql/conf.d/lowendbox.cnf”
default-storage-engine = myisam
Just add it before the “END”, so it looks like this:
function install_mysql {
# Install the MySQL packages
check_install mysqld mysql-server
check_install mysql mysql-client
# Install a low-end copy of the my.cnf to disable InnoDB, and then delete
# all the related files.
invoke-rc.d mysql stop
rm -f /var/lib/mysql/ib*
cat > /etc/mysql/conf.d/lowendbox.cnf <<END
[mysqld]
key_buffer = 8M
query_cache_size = 0
skip-innodb
default-storage-engine = myisam
END
invoke-rc.d mysql start
# Generating a new password for the root user.
passwd=`get_password root@mysql`
mysqladmin password "$passwd"
This may need a way to clear the permissions too, because setting the password isn’t working further down the line. I ended up just rebuilding the VPS, since I was merely testing this out on a new one.
Hi there, yes this post is in fact nice and I have learned lot of things from it on the topic of blogging. thanks.
Hi,
Many thanks for script!
Can you recommend some easy to install script that will set basic security on server, like changing SSH port, removing SSH root access, tmp, etc..all other steps that are usually set for security.
2nd question:
What wordpress cashing setup do you use on lowendbox WordPress/Nginx/PHP/MySQL.
And does this site lowendbox run on the same setup like this script?
Anybody please?
Can owner of this site share his wordpress setup please?
u can check my blog
I have learned lot of things from it on the topic of blogging. thanks.
It’s actually a great and helpful piece of info. I am glad that you shared this useful info with us. Please keep us up to date like this. Thanks for sharing.
hi, i had use you script to install wp, but i can not success. is this script still works????
nice info sir… tanks for share. but i tray in Centos 6.6 32bit minimal any error while install exim
Can we run dynamic wordpress site with email on 250 MB ram easily?
Great, it’s working fine, :D Many thanks for sharing this :)
!!!
I have little knowledge of nginx 502 Bad Gateway I get the following when I tested it for my main blog. Is their anyway to tune this?
It’s crazy this script is from 2010 and still fine and way ahead of the curve. If you think about it before DigitalOcean and all the new cloud networks too.
Any opinion about the SlickStack WordPress installer? https://github.com/littlebizzy/slickstack
Great.