After installing the lnmp environment many times, I gradually wrote shell scripts, but every time I had to go to the nginx, PHP, and MySQL official websites to check the latest stable version, download it, and install it again, which was very difficult.
Now it is finally implemented:
1. Check the latest stable version on the official nginx, PHP, and MySQL websites and download and install it automatically.
2. Offline installation is supported.
3. The root and sudo permissions are not required, making it safer.
4. Add php-fpm.sh, mysqld. Sh, and use the same control method as nginx.
Start nginx:./nginx.ShDisable nginx :./Nginx.Sh-S stop restart nginx :./Nginx.Sh-S reload starts PHP :./PHP-FPM.ShClose PHP :./PHP-FPM.Sh-S stop restart PHP :./PHP-FPM.Sh-S reload start MYSQL :./MySQL/mysqld.ShClose MYSQL :./MySQL/mysqld.Sh-S stop
Project address: http://code.taobao.org/p/lnmp/
Script: http://code.taobao.org/svn/lnmp/trunk/src/lnmp.sh
Script URL: http://dwz.cn/lnmp-sh
Procedure:
WgetHTTP://Dwz.cn/lnmp-shChmod+ X lnmp-Sh./Lnmp-Sh
Offline installation:
./Lnmp-Sh-I offline
Principles:
#! /Bin/ Bash # nginx version check Echo ' Check nginx online ' Wget -NV http: // Nginx.org/en/download.html-O nginx.html # Official nginx download page. Format... <H4> stable version </H4> </center> <Table width = " 100% " > < Tr > <TD width = " 20% " > <A href = " /En/changes-1.2 " > Changes- 1.2 </A> </TD> <TD width =" 20% " > <A href = " /Download/nginx-1.2.7.tar.gz " > Nginx- 1.2 . 7 </A> ...Html = $ ( Cat Nginx.html) # extract the string from the left to the right. </H4> </center> <Table width = " 100% " > < Tr > <TD width = " 20% " > <A href = " /En/changes-1.2 " > Changes- 1.2 </A> </TD> <TD width = " 20% " > <A href = " /Download/nginx-1.2.7.tar.gz " > Nginx-1.2 . 7 </A> ... TMP =$ {Html #* ' Stable version ' } # Extract the string after the last string from the right to the left to obtain </H4> </center> <Table width = " 100% " > < Tr > <TD width = " 20% " > <A href =" /En/changes-1.2 " > Changes- 1.2 </A> </TD> <TD width = " 20% " > <A href = " /Download/nginx-1.2.7 Tmp2 =$ {TMP % ' .Tar.gz ' * } # Extract the string after the last string from left to right and get 1. 2.7 Nginxversion =$ {Tmp2 ##* ' Nginx- ' } Echo ' Nginx: ' $ Nginxversion
When the HTML format on the official nginx, PHP, and MySQL websites is modified, the version will fail to be detected and the script will be updated accordingly.