Nginx Autoinstaller

I have published article about my modified nginx auto installer about little over a year ago. Which can be found here. Which got somewhat famous and counted over 1000 installs. The framework which I was used was came from a chinese developer called licess and the framework now has been evolved a lot and now we can count it as fully fledged auto installer.  It now includes latest nginx version ( Which lacked at the time which I modified the script to include the latest and greatest) . And also now it includes separately tweaked installers for debian, centos, and ubuntu, which I had on my modified installer since day one icon smile Nginx Autoinstaller   So its nice to see that he baked 2 options which my modified installer had since day one.

trans Nginx Autoinstaller

This installer is extremely useful but its not popular in the international community since its written in Chines and no support provided on English.  So with this post I just wanted to introduce that great tool to you guys and edit the original source code little bit to remove the time zone rewrites.

What I have removed

  •  Original installer rewrites the time zone to China. I have removed that so your original time zone will remain on the server.

All the credits must go to Licess at www.lnmp.org and you can donate him there. I take no credit for this and I’m just listing the installer here and I just wanted to provide some support for it in English, thats the moral of the post!

What does the installer include

  • Nginx 1.0.10
  • PHP 5.2.17
  • Mysql 5.1.60
  • PHPMyAdmin
  • Eaccelerator (optional 1 click install)
  • VsFTPd, PureFTPd (Optional 1 click install)
  • PHP Suhousin Patch
  • Memcached (optional)
  • Zend Optimizer

install Instructions-

You can use debian/ubuntu/centos 32bit or 64bit. So login via SSH and issue these commands (you must be root user to install LNMP )-

1. Download the installer package-

wget -c http://www.ruchirablog.com/lnmp0.8-full.tar.gz

2. Decompress the install package-.

tar zxvf lnmp0.8-full.tar.gz

3. Go to install directory-

cd lnmp0.8-full /

4.  Start installing-

For ubuntu  – sh ubuntu.sh

For Centos  – sh centos.sh

For Debian – sh debian.sh

It will ask some questions like your domain name , mysql root password ( Use your root password if you are newbie) just answer to them promptly.

It will take at least 30 minutes to fully install and then you will see a massage saying install completed. So then you can try navigating to your ip address to see it working.

After installation -

  • PHPMyAdmin will be located on http://yourip/phpmyadmin
  • Navigate to your url or ip and it will display a test page

1, install eAccelerator, execute the following command.  / eaccelerator.sh , follow the prompts to select the version, press Enter, it will automatically install and restart the web service.

2, the installation of ionCube, execute the following command  / ionCube.sh Enter to confirm, it will automatically install and restart the web service.

3, the installation imageMagick, execute the following command  / imageMagick.sh Enter to confirm, it will automatically install and restart the web service.

4, install memcached, execute the following command  / memcached.sh Enter to confirm, it will automatically install and restart the web service.

And a advantage of  the new installer is you can upgrade nginx or php with just one shell command.
  • To upgrade the nginx  execute the following command:. / upgrade_nginx.sh It will prompt a thing which you need to enter the nginx version number. Its simply asking which version that you want to upgrade. So head over to http://nginx.org/en/download.html and find whats the newest nginx version and enter the number correctly on the shell prompt. For ex- 1.0.10 and press enter. its just easy!
  • PHP  upgrade, execute the following command:. / upgrade_php.sh prompted, enter your php version number, such as 5.3.6.

You can manage the LNMP by issuing these commands-

/root/lnmp {start | stop | reload | restart | kill | status}

  • For example if you want to restart lnmp issue /root/lnmp restart

LNMP files will be located on
mysql: /usr/local/mysql
php: /usr/local/php
nginx: /usr/local/nginx
Site Directory: /home/wwwroot

How to add more domains (Virtual hosts) for this setup?

You can add more domains to your setup with easy steps. You just need to open your SSH client and type

./vhost.sh

And it will ask you which domain name to add also if you are setting up new domain for wordpress it can automatically add rewrite rules for your permalinks icon smile Nginx Autoinstaller Just answer for the questions when you run ./vhost.sh

new lnmp Nginx Autoinstaller

Here are another guides for full LNMP 0.8 setup!

So enjoy your server and please add a comment if you are happy with outcome!

PS- To keep in touch with updates (next releases) of this script you can subscribe to my email feed. No advertising or spam will be sent. You can unsubscribe at anytime! icon smile Nginx Autoinstaller
 Nginx Autoinstaller

Enter your email address:
I'm Ruchira Sahan and all posts on this blog are completely my thoughts and writings. I love DIY and Technology. So feel free to contact me for anything about this blog and don't forget to add a comment if this blog helped you! Thanks
 Nginx Autoinstaller
Ruchira
View all posts by Ruchira

{ 362 comments… read them below or add one }

LOse February 24, 2011 at 9:02 PM

Great installer
but
Need for margento!!
problem installing database connection error..

Reply

Ruchira February 24, 2011 at 9:32 PM

thats not a common error! Check your passwords! Database password is also the password that you supplied while installing. Also database administrator password is root on default!

Reply

LOse February 26, 2011 at 5:27 PM

its was innoDB mysql problem solve.
can you release with php 5.3.5
thank you

Reply

LOse February 27, 2011 at 9:32 PM

also APC + Memcache way better

Reply

egi February 28, 2011 at 6:04 AM

LNMP 0.6 was out..but nothing new on that package..
for anyone who wants to upgrade the nginx version for lnmp, just try this:

wget soft.vpser.net/lnmp/upgrade_nginx.sh;sh upgrade_nginx.sh

Reply

Tai Pe N March 6, 2011 at 8:31 AM

./vhost.sh is not works properly.

Please write a tutorial ./vhost.sh and Domain panel, how to set that?

Reply

Ruchira March 8, 2011 at 6:41 AM

what is the problem that you getting?

Reply

me March 6, 2011 at 9:17 AM

needs lib-crypt and lib-mhash adding to the yum installs at the top of censos.sh

Reply

Ruchira March 8, 2011 at 6:41 AM

can you tell me what version of centos that you using?

Reply

callum March 9, 2011 at 9:27 AM

5.5×86 64bit
its because the libmhash and libmcrypt links in your centos.sh script are 404′s
yum install libmhash-devel libmcrypt-devel
fixed it for me but you might want to fix those 404′s in the script

Reply

Ruchira March 11, 2011 at 5:58 AM

Thanks mate! Looks like someone removed those 2 files from my server because proper file permissions not set for those installation files. Now I have added permissions and 2 files.
Thanks again

Reply

callum March 12, 2011 at 7:08 AM

this *should* fix all of the php not building comments.

Reply

callum March 12, 2011 at 7:28 AM

for centos/rhel etc. not so sure about the other flavours

Reply

Ruchira March 12, 2011 at 7:38 AM

yes other using the same thing! Thanks again for pointing this problem! :)

me March 6, 2011 at 9:18 AM

sorry lib-crypt-devel and lib-mhash-devel

Reply

me March 6, 2011 at 9:20 AM

otherwise the build fails

Reply

khal March 10, 2011 at 5:05 AM

Hello Kushira,

I have got the problem that many got here, the php not installing:
/usr/local/php/sbin/php-fpm: No such file or directory

How can i manually reinstall it

#more /etc/debian_version
6.0

Can i use apt-get install and which packages should i use ?

Thanks

Reply

Ruchira March 10, 2011 at 6:27 AM

Oops! I didnt had time to test this script with debian 6. Looks like it got problems. For now can you install debian 5 ( If you are using vps this will be easy) and after the installation update to debian 6? It will work for now. However Ill work on this to get it working with debian 6 but no ETA yet!
Thanks for mentioning this!

Reply

khal March 10, 2011 at 8:07 AM

Thanks kushira for your fast response
But for example can you install nginx “manually” and then install php5 and with apt-get , whats the difference in installing with apt-get and the manually install ?

Greeting from france

Reply

Ruchira March 11, 2011 at 5:45 AM

Not much difference but with normal install you can have more custom with your choices while apt-get does predefined thing!

Reply

denir March 13, 2011 at 2:28 PM

thank you for the auto installer
but when I go to mydomain.com/phpmyadmin and parsing .phpI got 502 Bad Gateway?
I’m using Debian 5 32bit

Reply

Ruchira March 14, 2011 at 5:11 AM

use debian 4 to install this and upgrade to debian 5 or 6 after installing. Or use ubuntu 10.04 which is same functioning as debian

Reply

Dan March 15, 2011 at 2:40 PM

hey, thanks for the great instructions. I have one small question. How do I get to the mysql console? I want to import a larger database that is to big for phpmyadmin.

when I try
mysql -u root -p mypass -h localhost databasename < sqlfile.sql
I get this error
bash: mysql: command not found

Reply

Ruchira March 15, 2011 at 5:18 PM

do you mind using bigdump? google it! very easy to use!

Reply

egi March 19, 2011 at 8:39 AM

Hi Ruchira,
tis lnmp is running smooth on my wordpress with lowend traffic,
but when i tried to install in other box, wordpress with high traffic (400 online in the same time) it become slower and i get high load cpu from php-fpm.
can i see yout php-fpm setting for my example ruchira?
Thanks

Reply

Ruchira March 19, 2011 at 9:46 AM

give your server data before getting in to conclusion! I mean what are the specs of your server? And what are the mods you done to default php-fpm file?

Reply

egi March 19, 2011 at 10:34 AM

it is xen vps with 512 memory..i only tried to incrase and decrase php max_children but still no change

Reply

Ruchira March 19, 2011 at 8:45 PM

Install memecached!
http://www.ruchirablog.com/memcached-wordpress/
http://www.ruchirablog.com/intergrating-memcached-to-wordpress/

There is no way 512MB handling 400 users at a time with wordpress fast like you expect if you not using memcached! Try memcached. if you have atleast 1000 posts you need to upgrade because your ram isnt much to handle memcached instance!

And if you are getting CPU loads less than 50% there is nothing to worry! Dont expect CPU loads to be like 0.1% when you have 400 users online at a time.

Reply

gazy March 21, 2011 at 7:02 AM

e1550 emi354638047593750

Reply

Ruchira March 22, 2011 at 8:23 AM

IMEI: 354638047593750

Entsperren / Unlock: 63729412
Flashen / Flash: 40798721

Reply

Mike McGhee March 31, 2011 at 7:15 PM

Upgrading to 10.10 breaks this, reloading lnmp I get “./lnmp: line 70: /usr/local/php/sbin/php-fpm: No such file or directory”. Also get a 502 on /phpmyadmin. Tried it 3 times.

Reply

Ruchira April 1, 2011 at 2:02 AM

actually I have tried upgrading to 10.10 months ago and nothing happened!

Reply

onel0ve April 6, 2011 at 8:12 PM

can you add xcache and memcached

Reply

TioPepe April 13, 2011 at 4:45 AM

Hello mate, great job with your script,
I have a question, I need to protect one of my folders with but can not find the
configuration sites-available , you can tell me where it is in debian or how to protect my folder htpassswd and file I have to change?

Cheers

Reply

pain May 2, 2011 at 3:21 AM

hello sir,
i found this site through LEB discussion.
my question is, i have using LEB Nginx script. very easy to install wordpress.
my problem is, i can not install phpmyadmin.
i go to your script, i see phpmyadmin is support, but i dont see the command for installing wordpress.
how to install wordpress, do i need download wordpress installation?

thank you

Reply

Ruchira May 2, 2011 at 6:16 AM

you can download wordpress and use Filezilla to connect via SFTP and place wordpress files on the server! Its very very easy!

Reply

stranded May 3, 2011 at 2:59 AM

I keep on getting 502 Bad Gateway while trying to get into phpMyAdmin, clean Linode 512 VPS running Ubuntu 10.04.

Any ideas?

Reply

Ruchira May 3, 2011 at 3:17 AM

oops. Can you try using 9.04 and install LNMP then upgrade to 10.04? 10.04 isnt working because apt-get upgrade changed some files of old 10.04

Reply

stranded May 3, 2011 at 3:20 AM

Unfortunately Linode does not have Ubuntu 9.04. I might try Debian now.

Reply

Ruchira May 3, 2011 at 3:24 AM

just digged the linode manager and found that linode got 8.04 :) You can use it and then upgrade very easy to 10.04 LTS ! Im using Ubuntu 10.04 and I think its just small leap ahead of updates than Debian

Reply

stranded May 3, 2011 at 3:55 AM

502 Bad Gateway on Ubuntu 8.04…

Reply

Ruchira May 3, 2011 at 6:11 AM

thats really odd!

Reply

stranded May 3, 2011 at 2:38 PM

Hi, me again. I’ve tried With 8.04 again (after installing updates for it, but didn’t upgraded to 10.04) and the main domain I’ve used works (www.steamunpowered.com) but phpmyadmin still gives 502. The same goes for my other domain (www.stranded.eu).

What could be causing this? I’ve done everything according to the instructions…

Reply

Ruchira May 3, 2011 at 9:17 PM

this happens because some php libraries missing from the install! I need to investigate this problem and it takes time. Ill get in to it hopefully today and inform you!

Reply

atulaus May 3, 2011 at 10:05 AM

My Web access to every number up to 200 people are often in very slow web online ask what I have to set parameters I had to install memcache
vps for my ram so I think 2GB chip I7 LNMP config somewhere by relatively low

Reply

Ruchira May 3, 2011 at 10:43 AM

hmmm I cant understand your comment!

Reply

atulaus May 3, 2011 at 10:57 AM

I can increase my number to nginx to run faster when more people view site?

Reply

Ruchira May 3, 2011 at 9:15 PM

it will not do much difference if you dont have much CPU cores and RAM

Reply

atulaus May 3, 2011 at 10:07 PM

ram 2Gb chip core I7 is enough?

Reply

Ruchira May 4, 2011 at 1:15 AM

whats your average simultaneous user amount? and do you getting any slow downs? Whats your web site?

Reply

atulaus May 4, 2011 at 9:24 AM

whats your average simultaneous user amount? 100 – 200
and my site became very slow

atulaus May 4, 2011 at 3:34 PM

502 Bad Gateway
please help me
i change fastcgi_pass unix:/tmp/php-cgi.sock to fastcgi_pass 127.0.0.1:9000;
is not work

Reply

Ruchira May 4, 2011 at 7:11 PM

why do you change that?

Reply

atulaus May 8, 2011 at 5:13 PM

I think it will not lead to errors 502 Bad Gateway

Reply

dante May 5, 2011 at 6:03 AM

Hello,

I’ve installed you’re Nginx Autoinstaller in a server 8 go of ram, double core of proc with debian 5 32 bits
It work fine, so thanks guy

I’ve tested it with debian 6 64 bits but the install was corrupted

I’ve just a little problem : the phpmyadmin isn’t installed How can I reinstall it properly please ?

Reply

Ruchira May 5, 2011 at 6:07 AM

If you got 8GB of ram why are you wasting your RAM? 8GB of ram doesnt supported by 32bit. PHPmyadmin got some problems. Please read other comments! you can try with ubuntu 9.04 or 10.04

Reply

dante May 5, 2011 at 6:21 AM

The autoinstaller didn’t worked with the debian 6 64 bits. So I’ve tested with the debian 5 32 bits
I didn’t know that 32 bits don’t supported 8 go of ram : I’m confuse

Reply

pandjie May 8, 2011 at 2:33 PM

how we can delete domain on nginx?
sorry for my bad english

Reply

Ruchira May 8, 2011 at 7:39 PM

its little bit complicated! But delete the files via SFTP and then delete the DNS entries on your domain! You wont get trouble!

Reply

atulaus May 8, 2011 at 5:15 PM

hi ruchia
please Your email?
I want to ask you about Lnmp thanks

Reply

shaifful June 17, 2011 at 8:07 PM

Hi, need to know how about installing php 5.2.17?

Reply

Dimitris June 19, 2011 at 11:34 PM

How can i update the PHPMyAdmin to latest version after setup of your script?

Also i need to update to latest Nginx as on Centos i got a very old version.

Thank you

Reply

gepe July 15, 2011 at 5:55 AM

error
./configure: line 30026: 6: Bad file descriptor
i installed it on debian 5

Reply

reza August 8, 2011 at 1:08 PM

hi
how to update packages?
yum upgrade do not work!?

Reply

Ruchira August 11, 2011 at 8:14 AM

yum wont work on this as this install is a custom one! Yum will only work if we used yum to install files!

Reply

idglabs August 10, 2011 at 11:05 AM

I installed on Centos 6 64bit is ok

but is possible to have the last version of all software

db mysql 5.5.
nginx 1.1.0
php 5.3.6

I use this to update nginx to 1.1.0
wget soft.vpser.net/lnmp/upgrade_nginx.sh;sh upgrade_nginx.sh

nginx: nginx version: nginx/1.1.0
=========================================================================
You have successfully upgrade from 0.7.67 to 1.1.0
=========================================================================
LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux

But need to update mysql database
and php to last version

regards

did you do a good job.

Reply

Damir-ElggFactory August 28, 2011 at 1:50 PM

@idglabs,
After nginx upgrade to 1.1 did you notice any improvements? have any issues?
Thanks.

Reply

William August 16, 2011 at 1:19 PM

The Debian/Ubuntu option is clearly broken. PHP is DoA.

CentOS works perfectly.

Reply

Matthew August 25, 2011 at 2:13 PM

awesome work, but i am getting 404 errors on trying to download sqlite.bz2 file….. it has tried about 2 mirrors and not one seems to have that file

Reply

Ruchira August 26, 2011 at 9:21 PM

hmm did you tried lnmp.org mirror?

Reply

Damir-ElggFactory August 28, 2011 at 9:06 AM

It seems broken now for Debian 5 :(
Installed it several times last year with no issues but now it displays many errors like “./configure: line 17737 :5 :bad file descriptor ” and it hangs on “./configure: line 313 :5 :bad file descriptor”

anyone knows what’s up ?

Thanks.

Reply

Ruchira August 28, 2011 at 9:58 PM

yeah debian 5 latest updates might broke it! You can try http://www.lnmp.org auto installer. they have the newest one!

Reply

Damir-ElggFactory August 29, 2011 at 6:29 AM

Thanks Ruchira, I really like your version tho :)
Are there any benefits or downfalls that you are aware of for running it on Centos insted of Debian?
Thanks.

Reply

Ruchira August 29, 2011 at 8:41 AM

absolutely no! There is no much difference. It depends on your flavor :) I like Ubuntu most because its stable, easy to use, apt-get is really nice etc. http://www.ruchirablog.com/uptime.php :) I’m running this blog on ubuntu 10.04 and you can see that im having nearly a year of uptime with it :) Im having about 1500 visitors and 2000 page views a day and server load is not going beyond 2 on average! Which is really nice for XEN VPS with 512MB of ram.

But hey I have boxes running Centos too. and in my experience I found that centos cpu load is fluctuating than my ubuntu setups.

Reply

Damir-ElggFactory August 28, 2011 at 9:25 AM

I guess I’ll try Centos since William reports that works still. I really would like to use Debian but have no choice unless it gets fixed or someone finds workaround.

Reply

r3z4prof August 28, 2011 at 9:12 PM

hi ruchira, im trouble when i want to upload plugin, that need
Hostname
FTP Username
FTP Password
Connection Type

how to i configured this one??
thanks :)

Reply

Ruchira August 28, 2011 at 9:56 PM

you need to install FTP deamon to auto update and install plugins/themes/wordpress! You can search for guide to install FTP. Or you can go oldschool by manually upload updated plugins by overwriting old plugins! Thats what I do!

Reply

gunnzolder September 18, 2011 at 4:10 PM

how do i configure the firewall?

# service iptables restart
give no result

#which iptables
/sbin/iptables
content of iptables seems not readable

how do i add rules if needed?

Reply

Chris October 27, 2011 at 7:16 PM

Once you’ve completed the steps in this post. Would you say that your server is secured enough for a Wordpress blog? I plan on switching to Linode and am considering using this as a tutorial to setting up my VPS. I was even thinking about dropping cPanel but I just fear for security.

Reply

Ruchira October 27, 2011 at 10:35 PM

The best example that you can see is this blog. If you need more security you can install more stuff additionally to this!

Reply

RJ October 31, 2011 at 3:51 AM

The script ran with no visible errors and phpmyadmin comes up properly. Was able to set up a database without any problems. This is our third attempt with setting up nginx on centos. This time we tried not to add a 2nd vhost, but rather place a magento install in the root to see if it would work. The enginx is installed page comes right up at http://96.45.117.141 but as soon as you visit http://96.45.117.141/index.php to load the install, it redirects to the install folder as it should, but then doesn’t show the index.php file, but a 404 instead. When you add the index.php to the url, the server returns “no input specified” http://96.45.117.157/index.php/install/index.php

I can not figure out what the problem is. This is directly following the auto-installer without modifying the conf file. Any insight would be greatly appreciated.

Reply

nima January 26, 2012 at 2:18 AM

dude,
is it work on ns1. domain.com and ns2 ?

with godady we use dns manege and point ip to domain without host .
then this script will install dns with ns1 and ns2 of that domain ?

Reply

Ruchira February 15, 2012 at 1:04 AM

read my guide about dns! This will work fine on external dns setup!~

Reply

nima January 26, 2012 at 6:41 AM

can we rename domain with ./vhost.sh ?i mean park doamin instead of add new domain
which works on /home/wwwroot NOT /home/wwwroot/domain.com

Reply

Ruchira February 15, 2012 at 1:03 AM

no you cant rename domains!

Reply

peter February 8, 2012 at 1:36 AM

pureftp is in chinese language. How can I uninstall it?

Reply

Ruchira February 15, 2012 at 12:01 AM

arggg! Didnt saw that! :( maybe there is a switch for language!

Reply

Jens February 13, 2012 at 12:35 PM

Hello,

i think a auto installer of nginx is a great thing. Thank you. I see after the installation your welcome screen, but I can not call phpmyadmin when i call 127.0.01/phpmyadmin oder locahost. I need your help (:

Reply

Ruchira February 14, 2012 at 11:48 PM

whats the error coming up?

Reply

Flyg Till Erbil February 17, 2012 at 6:59 PM

liked this article Nginx Autoinstaller and i really don’t strive to be that individual… but i do believe maybe your blog could look a little bit better if you would have a litte red in it. Simply just my suggestion, truly appreciated the post otherwise :P Thanks, Flyg Till Erbil

Reply

Ruchira February 19, 2012 at 10:56 PM

hahah nice dude :) Ill consider this when I build next design :)

Reply

Leave a Comment