From 9d484acd6d928f09ad1e0fb843ecad05ad7e8d1b Mon Sep 17 00:00:00 2001 From: licess Date: Mon, 1 Jun 2015 16:39:19 +0800 Subject: [PATCH] update to lnmp v1.2 --- ChangeLog | 21 + License | 5 + README | 86 +- addons.sh | 137 +++ apache.sh | 351 ------ centos.sh | 973 ---------------- conf/CentOS-Base-163.repo | 52 + conf/config.inc.php | 1 + conf/enable-php-pathinfo.conf | 7 + conf/enable-php.conf | 7 + conf/enable-ssl-example.conf | 44 + conf/httpd-default.conf | 10 +- conf/httpd-mpm.conf | 110 -- conf/httpd-vhosts-lamp.conf | 29 + ...pd-vhosts.conf => httpd-vhosts-lnmpa.conf} | 9 +- conf/{httpd.conf => httpd22-lamp.conf} | 176 ++- conf/httpd22-lnmpa.conf | 479 ++++++++ conf/httpd24-lamp.conf | 509 +++++++++ conf/httpd24-lnmpa.conf | 510 +++++++++ conf/index.html | 21 +- conf/lamp | 510 +++++++++ conf/lnmp | 572 ++++++++++ conf/lnmp.gif | Bin 0 -> 5683 bytes conf/lnmpa | 570 ++++++++++ conf/{memcached.php => memcached1.php} | 18 +- conf/memcached2.php | 47 + conf/mod_remoteip.conf | 3 + conf/mysql_sec_script.sql | 7 + conf/nginx.conf | 159 ++- conf/nginx_a.conf | 162 ++- conf/ocp.php | 390 +++++++ conf/{php-fpm.conf => php-fpm5.2.conf} | 0 conf/proxy-pass-php.conf | 17 + conf/pureftpd-mysql.conf | 2 +- conf/{script.mysql => pureftpd-script.sql} | 6 +- conf/{ => rewrite}/dabr.conf | 0 conf/{ => rewrite}/dedecms.conf | 0 conf/{ => rewrite}/discuz.conf | 0 conf/{ => rewrite}/discuzx.conf | 0 conf/{ => rewrite}/discuzx2.conf | 0 conf/{ => rewrite}/drupal.conf | 0 conf/{ => rewrite}/ecshop.conf | 0 conf/{ => rewrite}/none.conf | 0 conf/{ => rewrite}/phpwind.conf | 0 conf/{ => rewrite}/sablog.conf | 0 conf/{ => rewrite}/shopex.conf | 0 conf/{ => rewrite}/typecho.conf | 0 conf/rewrite/typecho2.conf | 12 + conf/{ => rewrite}/wordpress.conf | 0 conf/{ => rewrite}/wp2.conf | 0 conf/rpaf.conf | 6 - debian.sh | 1002 ---------------- eaccelerator.sh | 204 ---- imageMagick.sh | 98 -- include/apache.sh | 85 ++ include/eaccelerator.sh | 170 +++ include/end.sh | 192 ++++ include/imageMagick.sh | 52 + include/init.sh | 399 +++++++ include/ionCube.sh | 85 ++ include/main.sh | 429 +++++++ include/mariadb.sh | 108 ++ include/memcached.sh | 142 +++ include/mysql.sh | 259 +++++ include/nginx.sh | 69 ++ include/opcache.sh | 88 ++ include/php.sh | 581 ++++++++++ include/redis.sh | 92 ++ include/upgrade_mariadb.sh | 188 +++ include/upgrade_mysql.sh | 288 +++++ include/upgrade_mysql2mariadb.sh | 198 ++++ include/upgrade_nginx.sh | 54 + include/upgrade_php.sh | 566 ++++++++++ include/version.sh | 98 ++ include/xcache.sh | 111 ++ init.d/init.d.fail2ban | 106 ++ init.d/init.d.httpd | 113 ++ .../memcached-init => init.d/init.d.memcached | 47 +- init.d/init.d.nginx | 120 ++ init.d/init.d.php-fpm5.2 | 166 +++ init.d/init.d.pureftpd | 81 ++ init.d/init.d.redis | 62 + install.sh | 190 ++++ ionCube.sh | 90 -- lnmp | 98 -- lnmpa | 92 -- memcached.sh | 134 --- opcache.sh | 119 -- php5.2.17.sh | 210 ++-- proftpd.sh | 145 --- proftpd_vhost.sh | 116 -- pureftpd.sh | 318 +++--- redis.sh | 187 --- remove_disable_function.sh | 94 -- reset_mysql_root_password.sh | 55 - ...ches_disable_SSLv2_for_openssl_1_0_0.patch | 52 + src/patch/libiconv-glibc-2.16.patch | 13 + src/patch/mod_remoteip.c | 447 ++++++++ .../mysql-5.5-fix-arm-client_plugin.patch | 37 + src/patch/mysql-openssl.patch | 13 + src/patch/php-5.2-multipart-form-data.patch | 82 ++ src/patch/php-5.2.17-max-input-vars.patch | 81 ++ src/patch/php-5.2.17-xml.patch | 51 + src/patch/php-5.3-multipart-form-data.patch | 80 ++ tools/backup.sh | 87 ++ check502.sh => tools/check502.sh | 2 +- cut_nginx_logs.sh => tools/cut_nginx_logs.sh | 0 tools/denyhosts.sh | 49 + tools/denyhosts_removeip.sh | 22 + tools/fail2ban.sh | 50 + tools/remove_disable_function.sh | 89 ++ tools/reset_mysql_root_password.sh | 55 + ubuntu.sh | 1006 ----------------- uninstall.sh | 299 +++-- upgrade.sh | 81 ++ upgrade_lnmpa_php.sh | 221 ---- upgrade_mariadb.sh | 236 ---- upgrade_mysql.sh | 363 ------ upgrade_mysql2mariadb.sh | 279 ----- upgrade_nginx.sh | 139 --- upgrade_php.sh | 354 ------ vhost.sh | 197 ---- vhost_lnmpa.sh | 195 ---- xcache.sh | 249 ---- 124 files changed, 11085 insertions(+), 7863 deletions(-) create mode 100644 License create mode 100644 addons.sh delete mode 100644 apache.sh delete mode 100644 centos.sh create mode 100644 conf/CentOS-Base-163.repo create mode 100644 conf/enable-php-pathinfo.conf create mode 100644 conf/enable-php.conf create mode 100644 conf/enable-ssl-example.conf delete mode 100644 conf/httpd-mpm.conf create mode 100644 conf/httpd-vhosts-lamp.conf rename conf/{httpd-vhosts.conf => httpd-vhosts-lnmpa.conf} (88%) rename conf/{httpd.conf => httpd22-lamp.conf} (76%) create mode 100644 conf/httpd22-lnmpa.conf create mode 100644 conf/httpd24-lamp.conf create mode 100644 conf/httpd24-lnmpa.conf create mode 100644 conf/lamp create mode 100644 conf/lnmp create mode 100644 conf/lnmp.gif create mode 100644 conf/lnmpa rename conf/{memcached.php => memcached1.php} (72%) create mode 100644 conf/memcached2.php create mode 100644 conf/mod_remoteip.conf create mode 100644 conf/mysql_sec_script.sql create mode 100644 conf/ocp.php rename conf/{php-fpm.conf => php-fpm5.2.conf} (100%) create mode 100644 conf/proxy-pass-php.conf rename conf/{script.mysql => pureftpd-script.sql} (92%) rename conf/{ => rewrite}/dabr.conf (100%) rename conf/{ => rewrite}/dedecms.conf (100%) rename conf/{ => rewrite}/discuz.conf (100%) rename conf/{ => rewrite}/discuzx.conf (100%) rename conf/{ => rewrite}/discuzx2.conf (100%) rename conf/{ => rewrite}/drupal.conf (100%) rename conf/{ => rewrite}/ecshop.conf (100%) rename conf/{ => rewrite}/none.conf (100%) rename conf/{ => rewrite}/phpwind.conf (100%) rename conf/{ => rewrite}/sablog.conf (100%) rename conf/{ => rewrite}/shopex.conf (100%) rename conf/{ => rewrite}/typecho.conf (100%) create mode 100644 conf/rewrite/typecho2.conf rename conf/{ => rewrite}/wordpress.conf (100%) rename conf/{ => rewrite}/wp2.conf (100%) delete mode 100644 conf/rpaf.conf delete mode 100644 debian.sh delete mode 100644 eaccelerator.sh delete mode 100644 imageMagick.sh create mode 100644 include/apache.sh create mode 100644 include/eaccelerator.sh create mode 100644 include/end.sh create mode 100644 include/imageMagick.sh create mode 100644 include/init.sh create mode 100644 include/ionCube.sh create mode 100644 include/main.sh create mode 100644 include/mariadb.sh create mode 100644 include/memcached.sh create mode 100644 include/mysql.sh create mode 100644 include/nginx.sh create mode 100644 include/opcache.sh create mode 100644 include/php.sh create mode 100644 include/redis.sh create mode 100644 include/upgrade_mariadb.sh create mode 100644 include/upgrade_mysql.sh create mode 100644 include/upgrade_mysql2mariadb.sh create mode 100644 include/upgrade_nginx.sh create mode 100644 include/upgrade_php.sh create mode 100644 include/version.sh create mode 100644 include/xcache.sh create mode 100644 init.d/init.d.fail2ban create mode 100644 init.d/init.d.httpd rename conf/memcached-init => init.d/init.d.memcached (65%) create mode 100644 init.d/init.d.nginx create mode 100644 init.d/init.d.php-fpm5.2 create mode 100644 init.d/init.d.pureftpd create mode 100644 init.d/init.d.redis create mode 100644 install.sh delete mode 100644 ionCube.sh delete mode 100644 lnmp delete mode 100644 lnmpa delete mode 100644 memcached.sh delete mode 100644 opcache.sh delete mode 100644 proftpd.sh delete mode 100644 proftpd_vhost.sh delete mode 100644 redis.sh delete mode 100644 remove_disable_function.sh delete mode 100644 reset_mysql_root_password.sh create mode 100644 src/patch/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch create mode 100644 src/patch/libiconv-glibc-2.16.patch create mode 100644 src/patch/mod_remoteip.c create mode 100644 src/patch/mysql-5.5-fix-arm-client_plugin.patch create mode 100644 src/patch/mysql-openssl.patch create mode 100644 src/patch/php-5.2-multipart-form-data.patch create mode 100644 src/patch/php-5.2.17-max-input-vars.patch create mode 100644 src/patch/php-5.2.17-xml.patch create mode 100644 src/patch/php-5.3-multipart-form-data.patch create mode 100644 tools/backup.sh rename check502.sh => tools/check502.sh (88%) rename cut_nginx_logs.sh => tools/cut_nginx_logs.sh (100%) create mode 100644 tools/denyhosts.sh create mode 100644 tools/denyhosts_removeip.sh create mode 100644 tools/fail2ban.sh create mode 100644 tools/remove_disable_function.sh create mode 100644 tools/reset_mysql_root_password.sh delete mode 100644 ubuntu.sh create mode 100644 upgrade.sh delete mode 100644 upgrade_lnmpa_php.sh delete mode 100644 upgrade_mariadb.sh delete mode 100644 upgrade_mysql.sh delete mode 100644 upgrade_mysql2mariadb.sh delete mode 100644 upgrade_nginx.sh delete mode 100644 upgrade_php.sh delete mode 100644 vhost.sh delete mode 100644 vhost_lnmpa.sh delete mode 100644 xcache.sh diff --git a/ChangeLog b/ChangeLog index 7cbadd5b..b5b9785f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,26 @@ 更新记录 +2015年6月1日发布LNMP 1.2 + +完全重写优化安装脚本、升级脚本及组件安装等大部分脚本; +状态管理、虚拟主机管理、FTP管理及数据库管理全部采用lnmp命令替换,去掉/root/vhost.sh和/root/lnmp脚本; +Nginx、MySQL/MariaDB、PHP的升级脚本整合为upgrade.sh; +缓存、加速、imageMagick、ionCube等的安装卸载采用addons.sh进行; +增加SSH防护工具DenyHosts、Failban安装脚本及DenyHosts被封IP删除脚本; +增加新的备份脚本backup.sh; +支持的Linux发行版:CentOS 5-7、RHEL 6-7、Fedora 20-21、Aliyun、Debian 6-8、Raspbian、Ubuntu 10.10-15.04; +支持ARM平台,Raspberry Pi已测试; +MySQL安装时可选5.1.73、5.5.42、5.6.23,MariaDB可选5.5.42、10.0.17; +PHP安装时可选5.2.17、5.3.29、5.4.41、5.5.25、5.6.9; +安装时增加内存优化jemalloc或gperftools; +Apache安装时可选2.2.29或2.4.12; +Apache日志统一到/home/wwwlogs/下; +更新Nginx至1.8.0; +更新Zend Guard Loader至支持PHP 5.6; +Nginx配置文件进行了调整,启用php和pathinfo采用include方式,增加ssl范例配置; + + + 2014年6月1日发布LNMP 1.1 调整优化脚本安装脚本; diff --git a/License b/License new file mode 100644 index 00000000..e6e08dfe --- /dev/null +++ b/License @@ -0,0 +1,5 @@ +版权信息说明: +LNMP源码规本站所有,其他Nginx、PHP、MySQL等源码规原作者所有。 +1.任何用户均可免费使用LNMP +2.未经允许禁止修改后公开发布 +3.引用代码必须注明 \ No newline at end of file diff --git a/README b/README index 0158c92e..25bae453 100644 --- a/README +++ b/README @@ -3,82 +3,84 @@ LNMP一键安装包是什么? ————————————————————— - -LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RadHat、Debian/Ubuntu VPS服务器或独立主机安装LNMP(Nginx、MySQL/MariaDB、PHP、phpMyAdmin)生产环境的Shell程序。 +LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RadHat/Fedora、Debian/Ubuntu/Raspbian VPS(VDS)或独立主机安装LNMP(Nginx/MySQL/PHP)、LNMPA(Nginx/MySQL/PHP/Apache)、LAMP(Apache/MySQL/PHP)生产环境的Shell程序。同时提供一些实用的辅助工具如:虚拟主机管理、FTP用户管理、Nginx、MySQL/MariaDB、PHP的升级、常用缓存组件的安装、重置MySQL root密码、502自动重启、日志切割、SSH防护DenyHosts/Fail2Ban、备份等许多实用脚本。 LNMP官网:http://lnmp.org -作者:licess +作者: licess -------------------------------------------------------------------------------- - - 安装 ———— 详细安装教程参考:http://lnmp.org/install.html 安装前建议使用screen,执行:screen -S lnmp 后 -CentOS系统下执行:wget -c http://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz && tar zxf lnmp1.1-full.tar.gz && cd lnmp1.1-full && ./centos.sh -Debian系统下执行:wget -c http://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz && tar zxf lnmp1.1-full.tar.gz && cd lnmp1.1-full && ./debian.sh -Ubuntu系统下执行:wget -c http://soft.vpser.net/lnmp/lnmp1.1-full.tar.gz && tar zxf lnmp1.1-full.tar.gz && cd lnmp1.1-full && ./ubuntu.sh +执行:wget -c http://soft.vpser.net/lnmp/lnmp1.2-full.tar.gz && tar zxf lnmp1.2-full.tar.gz && cd lnmp1.2-full && ./install.sh {lnmp|lnmpa|lamp} 如断线可使用screen -r lnmp 恢复。 -LNMP升级到LNMPA,需在lnmp1.1-full目录下执行: -./apache.sh - -常用组件 +常用功能 ———————— -以下需在lnmp1.1-full目录下操作 -FTP服务器: -可选1,执行:./pureftpd.sh 安装,http://yourIP/ftp/ 进行管理。 -可选2,执行:./proftpd.sh 安装,/root/proftpd_vhost.sh 添加FTP账号。 +以下操作需在lnmp1.2-full目录下执行: + +FTP服务器:执行:./pureftpd.sh 安装,http://yourIP/ftp/ 进行管理,也可使用lnmp ftp {add|list|del}进行管理。 升级脚本: -可选1,执行:./upgrade_nginx.sh 可升级至任意Nginx版本。 -可选2,执行:./upgrade_php.sh 可升级至大部分PHP版本。 -可选3,执行:./upgrade_mysql.sh 可升级至任意MySQL版本,MySQL升级风险较大,虽然会自动备份数据,依然建议自行再备份一下。 -可选4,执行:./upgrade_mysql2mariadb.sh 可从MySQL升级至Mariadb,虽然会自动备份数据,依然建议自行再备份一下。 -可选5,执行:./upgrade_mariadb.sh 可升级已安装的Mariadb,虽然会自动备份数据,依然建议自行再备份一下。 -可选6,执行:./upgrade_lnmpa_php.sh 可升级LNMPA的PHP至大部分版本。 +执行:./upgrade.sh 按提示进行选择 +也可以直接使用参数:./upgrade.sh {nginx|mysql|mariadb|php|phpa|m2m} +参数: nginx 可升级至任意Nginx版本。 +参数: mysql 可升级至任意MySQL版本,MySQL升级风险较大,虽然会自动备份数据,依然建议自行再备份一下。 +参数: mariadb 可升级已安装的Mariadb,虽然会自动备份数据,依然建议自行再备份一下。 +参数: m2m 可从MySQL升级至Mariadb,虽然会自动备份数据,依然建议自行再备份一下。 +参数: php 仅适用于LNMP,可升级至大部分PHP版本。 +参数: phpa 可升级LNMPA/LAMP的PHP至大部分版本。 + 缓存加速: -可选1,执行: ./xcache.sh 安装,安装时需选择版本和设置密码, http://yourIP/xcache/ 进行管理,用户名 admin,密码为安装xcache时设置的。 -可选2,执行:./redis.sh 安装。 -可选3,执行:./memcached.sh 安装。 -可选4,执行:./opcache.sh 安装,http://yourIP/ocp.php 进行管理。 -可选5,执行:./eaccelerator.sh 安装。 +执行: ./addons.sh {install|uninstall} {eaccelerator|xcache|memcached|opcache|redis|imagemagick|ioncube} +参数: xcache 安装时需选择版本和设置密码, http://yourIP/xcache/ 进行管理,用户名 admin,密码为安装xcache时设置的。 +参数: redis +参数: memcached 可选择php-memcache或php-memcached扩展。 +参数: opcache http://yourIP/ocp.php 进行管理。 +参数: eaccelerator 安装。 +请勿安装多个缓存类扩展模块,多个可能导致网站出现问题。 图像处理: -可选1,执行:./imageMagick.sh 安装,imageMagick路径:/usr/local/imagemagick/bin/。 +参数: imageMagick imageMagick路径:/usr/local/imagemagick/bin/。 解密: 可选1,执行:./ionCube.sh 安装。 其他: -可选1,执行:./php5.2.17.sh 可安装一个不与LNMP冲突的PHP 5.2.17单独存在,使用时需要将nginx虚拟主机配置文件里的 php-cgi.sock 修改为 php-cgi52.sock。 +可选1,执行:./php5.2.17.sh 可安装一个不与LNMP冲突的PHP 5.2.17单独存在,目录在/usr/local/php52/,使用时需要将nginx虚拟主机配置文件里的 php-cgi.sock 修改为 php-cgi52.sock即可调用PHP5.2.17。 可选2,执行:./reset_mysql_root_password.sh 可重置MySQL/MariaDB的root密码。 可选3,执行:./check502.sh 可检测php-fpm是否挂掉,502报错时重启,配合crontab使用。 可选4,执行:./cut_nginx_logs.sh 日志切割脚本。 可选5,执行:./remove_disable_function.sh 运行此脚本可删掉禁用函数。 -可选6,如需卸载LNMP或LNMPA可执行:./uninstall.sh 按提示选择安装。 +可选6,如需卸载LNMP、LNMPA或LAMP可执行:./uninstall.sh 按提示选择即可卸载。 状态管理 ———————— -LNMP状态管理:/root/lnmp {start|stop|reload|restart|kill|status} -LNMPA状态管理:/root/lnmpa {start|stop|reload|restart|kill|status} -Nginx状态管理:/etc/init.d/nginx {start|stop|reload|restart} -MySQL状态管理:/etc/init.d/mysql {start|stop|restart|reload|force-reload|status} -MariaDB状态管理:/etc/init.d/mariadb {start|stop|restart|reload|force-reload|status} -PHP-FPM状态管理:/etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate} -PureFTPd状态管理:/etc/init.d/pureftpd {start|stop|restart|kill|status} -Apache状态管理:/etc/init.d/httpd {start|stop|restart|graceful|graceful-stop|configtest|status} - -添加虚拟主机:/root/vhost.sh -phpinfo:http://yourIP/phpinfo.php +LNMP/LNMPA/LMAP状态管理:lnmp {start|stop|reload|restart|kill|status} +Nginx状态管理:lnmp nginx或/etc/init.d/nginx {start|stop|reload|restart} +MySQL状态管理:lnmp mysql或/etc/init.d/mysql {start|stop|restart|reload|force-reload|status} +MariaDB状态管理:lnmp mariadb或/etc/init.d/mariadb {start|stop|restart|reload|force-reload|status} +PHP-FPM状态管理:lnmp php-fpm或/etc/init.d/php-fpm {start|stop|quit|restart|reload|logrotate} +PureFTPd状态管理:lnmp pureftpd或/etc/init.d/pureftpd {start|stop|restart|kill|status} +Apache状态管理:lnmp httpd或/etc/init.d/httpd {start|stop|restart|graceful|graceful-stop|configtest|status} + +虚拟主机管理 +———————————— +添加:lnmp vhost add +删除:lnmp vhost del +列出:lnmp vhost list + +相关图形界面 +———————————— PHPMyAdmin:http://yourIP/phpmyadmin/ +phpinfo:http://yourIP/phpinfo.php PHP探针:http://yourIP/p.php PureFtp用户管理:http://yourIP/ftp/ Xcache管理界面:http://yourIP/xcache/ @@ -107,4 +109,4 @@ Apache配置文件:/usr/local/apache/conf/httpd.conf 技术支持 ———————— -技术支持论坛:http://bbs.vpser.net/forum-25-1.html \ No newline at end of file +技术支持论坛:http://bbs.vpser.net/forum-25-1.html diff --git a/addons.sh b/addons.sh new file mode 100644 index 00000000..71f7c77d --- /dev/null +++ b/addons.sh @@ -0,0 +1,137 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script" + exit 1 +fi + +cur_dir=$(pwd) +action=$1 +action2=$2 + +. include/main.sh +. include/init.sh +. include/version.sh +. include/eaccelerator.sh +. include/xcache.sh +. include/memcached.sh +. include/opcache.sh +. include/redis.sh +. include/imageMagick.sh +. include/ionCube.sh + +Display_Upgrade_Menu() +{ + echo "##### cache / optimizer / accelerator #####" + echo "1: eAccelerator" + echo "2: XCache" + echo "3: Memcached" + echo "4: opcache" + echo "5: Redis" + echo "##### Image Processing #####" + echo "6: imageMagick" + echo "##### encryption/decryption utility for PHP #####" + echo "7: ionCube Loader" + echo "exit: Exit current script" + echo "#####################################################" + read -p "Enter your choice (1, 2, 3, 4, 5, 6, 7 or exit): " action2 +} + +Restart_PHP() +{ + if [ -s /usr/local/apache/bin/httpd ] && [ -s /usr/local/apache/conf/httpd.conf ] && [ -s /etc/init.d/httpd ]; then + echo "Restarting Apache......" + /etc/init.d/httpd restart + else + echo "Restarting php-fpm......" + /etc/init.d/php-fpm restart + fi +} + +clear +echo "+-----------------------------------------------------------------------+" +echo "| Addons script for LNMP V1.2, Written by Licess |" +echo "+-----------------------------------------------------------------------+" +echo "| A tool to Install cache,optimizer,accelerator...addons for LNMP |" +echo "+-----------------------------------------------------------------------+" +echo "| For more information please visit http://www.lnmp.org |" +echo "+-----------------------------------------------------------------------+" + +if [[ "${action}" == "" || "${action2}" == "" ]]; then + action='install' + Display_Upgrade_Menu +fi +Get_OS_Bit +Get_Dist_Name + + case "${action}" in + install) + case "${action2}" in + 1|e[aA]ccelerator) + Install_eAccelerator + ;; + 2|[xX]cache) + Install_XCache + ;; + 3|[mM]emcached) + Install_Memcached + ;; + 4|opcache) + Install_Opcache + ;; + 5|[rR]edis) + Install_Redis + ;; + 6|image[mM]agick) + Install_ImageMagic + ;; + 7|ion[cC]ube) + Install_ionCube + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: ./addons.sh {install|uninstall} {eaccelerator|xcache|memcached|opcache|redis|imagemagick|ioncube}" + ;; + esac + ;; + uninstall) + case "${action2}" in + e[aA]ccelerator) + Uninstall_eAccelerator + ;; + [xX]cache) + Uninstall_XCache + ;; + [mM]emcached) + Uninstall_Memcached + ;; + opcache) + Uninstall_Opcache + ;; + [rR]edis) + Uninstall_Redis + ;; + image[mM]agick) + Uninstall_ImageMagick + ;; + ion[cC]ube) + Uninstall_ionCube + ;; + *) + echo "Usage: ./addons.sh {install|uninstall} {eaccelerator|xcache|memcached|opcache|redis|imagemagick|ioncube}" + ;; + esac + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: ./addons.sh {install|uninstall} {eaccelerator|xcache|memcached|opcache|redis|imagemagick|ioncube}" + exit 1 + ;; + esac \ No newline at end of file diff --git a/apache.sh b/apache.sh deleted file mode 100644 index 24022a62..00000000 --- a/apache.sh +++ /dev/null @@ -1,351 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -printf "=======================================================================\n" -printf "Install Apache for LNMP, Written by Licess \n" -printf "=======================================================================\n" -printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" -printf "This script is a tool to install Apache for lnmp \n" -printf "\n" -printf "For more information please visit http://www.lnmp.org \n" -printf "=======================================================================\n" -cur_dir=$(pwd) -ipv4=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:"` - -if [ -s /usr/local/mariadb/bin/mysql ]; then - ismysql="no" -else - ismysql="yes" -fi - -echo "===========================" - - isinstallphp53="n" - echo "Install PHP 5.3.28,Please input y" - echo "Install PHP 5.2.17,Please input n or press Enter" - read -p "(Please input y or n):" isinstallphp53 - - case "$isinstallphp53" in - y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) - echo "You will install PHP 5.3.28" - isinstallphp53="y" - ;; - n|N|No|NO|no|nO) - echo "You will install PHP 5.2.17" - isinstallphp53="n" - ;; - *) - echo "INPUT error,You will install PHP 5.2.17" - isinstallphp53="n" - esac - -#set Server Administrator Email Address - - ServerAdmin="" - read -p "Please input Administrator Email Address:" ServerAdmin - if [ "$ServerAdmin" == "" ]; then - echo "Administrator Email Address will set to webmaster@example.com!" - ServerAdmin="webmaster@example.com" - else - echo "===========================" - echo Server Administrator Email="$ServerAdmin" - echo "===========================" - fi - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start install Apache for LNMP or Press Ctrl+C to cancel..." - char=`get_char` - -printf "===================== Check And Download Files =================\n" - -if [ -s httpd-2.2.27.tar.gz ]; then - echo "httpd-2.2.27.tar.gz [found]" - else - echo "Error: httpd-2.2.27.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/apache/httpd-2.2.27.tar.gz -fi - -if [ -s mod_rpaf-0.6.tar.gz ]; then - echo "mod_rpaf-0.6.tar.gz [found]" - else - echo "Error: mod_rpaf-0.6.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/apache/rpaf/mod_rpaf-0.6.tar.gz -fi - -if [ "$isinstallphp53" = "n" ]; then - if [ -s php-5.2.17.tar.gz ]; then - echo "php-5.2.17.tar.gz [found]" - else - echo "Error: php-5.2.17.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/php/php-5.2.17.tar.gz - fi -else - if [ -s php-5.3.28.tar.gz ]; then - echo "php-5.3.28.tar.gz [found]" - else - echo "Error: php-5.3.28.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/php/php-5.3.28.tar.gz - fi -fi -printf "=========================== install Apache ======================\n" - -echo "Stoping Nginx..." -/etc/init.d/nginx stop -if [ "$ismysql" = "no" ]; then - echo "Stoping MariaDB..." - /etc/init.d/mariadb stop -else - echo "Stoping MySQL..." - /etc/init.d/mysql stop -fi -echo "Stoping PHP-FPM..." -/etc/init.d/php-fpm stop -if [ -s /etc/init.d/memceached ]; then - echo "Stoping Memcached..." - /etc/init.d/memcacehd stop -fi - -echo "Backup old php configure files....." -mkdir /root/lnmpbackup/ -cp /root/lnmp /root/lnmpbackup/ -cp /usr/local/php/etc/php.ini /root/lnmpbackup/ -cp /usr/local/php/etc/php-fpm.conf /root/lnmpbackup/ - -cd $cur_dir -rm -rf httpd-2.2.27/ -tar zxvf httpd-2.2.27.tar.gz -cd httpd-2.2.27/ -./configure --prefix=/usr/local/apache --enable-mods-shared=most --enable-headers --enable-mime-magic --enable-proxy --enable-so --enable-rewrite --enable-ssl --enable-deflate --enable-suexec --with-included-apr --with-mpm=prefork --with-ssl --with-expat=builtin -make && make install -cd .. - -mv /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak -\cp $cur_dir/conf/httpd.conf /usr/local/apache/conf/httpd.conf -\cp $cur_dir/conf/httpd-default.conf /usr/local/apache/conf/extra/httpd-default.conf -\cp $cur_dir/conf/httpd-vhosts.conf /usr/local/apache/conf/extra/httpd-vhosts.conf -\cp $cur_dir/conf/httpd-mpm.conf /usr/local/apache/conf/extra/httpd-mpm.conf -\cp $cur_dir/conf/rpaf.conf /usr/local/apache/conf/extra/rpaf.conf - -cat >module.ini<>/usr/local/apache/conf/httpd.conf<>/usr/local/php/etc/php.ini<>/usr/local/php/etc/php.ini< /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -function InitInstall() -{ - cat /etc/issue - uname -a - MemTotal=`free -m | grep Mem | awk '{print $2}'` - echo -e "\n Memory is: ${MemTotal} MB " - #Set timezone - rm -rf /etc/localtime - ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - - yum install -y ntp - ntpdate -u pool.ntp.org - date - - rpm -qa|grep httpd - rpm -e httpd - rpm -qa|grep mysql - rpm -e mysql - rpm -qa|grep php - rpm -e php - - yum -y remove httpd* - yum -y remove php* - yum -y remove mysql-server mysql mysql-libs - yum -y remove php-mysql - - yum -y install yum-fastestmirror - yum -y remove httpd - #yum -y update - - #Disable SeLinux - if [ -s /etc/selinux/config ]; then - sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config - fi - - cp /etc/yum.conf /etc/yum.conf.lnmp - sed -i 's:exclude=.*:exclude=:g' /etc/yum.conf - - for packages in patch make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal nano fonts-chinese gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap diffutils; - do yum -y install $packages; done - - mv -f /etc/yum.conf.lnmp /etc/yum.conf -} - -function CheckAndDownloadFiles() -{ -echo "============================check files==================================" -if [ "$isinstallphp53" = "n" ]; then - if [ -s php-5.2.17.tar.gz ]; then - echo "php-5.2.17.tar.gz [found]" - else - echo "Error: php-5.2.17.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/php/php-5.2.17.tar.gz - fi - if [ -s php-5.2.17-fpm-0.5.14.diff.gz ]; then - echo "php-5.2.17-fpm-0.5.14.diff.gz [found]" - else - echo "Error: php-5.2.17-fpm-0.5.14.diff.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/phpfpm/php-5.2.17-fpm-0.5.14.diff.gz - fi -else - if [ -s php-5.3.28.tar.gz ]; then - echo "php-5.3.28.tar.gz [found]" - else - echo "Error: php-5.3.28.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/php/php-5.3.28.tar.gz - fi -fi - -if [ -s memcache-3.0.6.tgz ]; then - echo "memcache-3.0.6.tgz [found]" - else - echo "Error: memcache-3.0.6.tgz not found!!!download now......" - wget -c http://soft.vpser.net/web/memcache/memcache-3.0.6.tgz -fi - -if [ -s pcre-8.12.tar.gz ]; then - echo "pcre-8.12.tar.gz [found]" - else - echo "Error: pcre-8.12.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/pcre/pcre-8.12.tar.gz -fi - -if [ -s nginx-1.6.0.tar.gz ]; then - echo "nginx-1.6.0.tar.gz [found]" - else - echo "Error: nginx-1.6.0.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/nginx/nginx-1.6.0.tar.gz -fi - -if [ "$isinstallmysql55" = "n" ]; then - if [ -s mysql-5.1.73.tar.gz ]; then - echo "mysql-5.1.73.tar.gz [found]" - else - echo "Error: mysql-5.1.73.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/mysql/mysql-5.1.73.tar.gz - fi -elif [ "$isinstallmysql55" = "y" ]; then - if [ -s mysql-5.5.37.tar.gz ]; then - echo "mysql-5.5.37.tar.gz [found]" - else - echo "Error: mysql-5.5.37.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/mysql/mysql-5.5.37.tar.gz - fi -else - if [ -s mariadb-5.5.37.tar.gz ]; then - echo "mariadb-5.5.37.tar.gz [found]" - else - echo "Error: mariadb-5.5.37.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/mariadb/mariadb-5.5.37.tar.gz - fi -fi - -if [ -s libiconv-1.14.tar.gz ]; then - echo "libiconv-1.14.tar.gz [found]" - else - echo "Error: libiconv-1.14.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/libiconv/libiconv-1.14.tar.gz -fi - -if [ -s libmcrypt-2.5.8.tar.gz ]; then - echo "libmcrypt-2.5.8.tar.gz [found]" - else - echo "Error: libmcrypt-2.5.8.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/libmcrypt/libmcrypt-2.5.8.tar.gz -fi - -if [ -s mhash-0.9.9.9.tar.gz ]; then - echo "mhash-0.9.9.9.tar.gz [found]" - else - echo "Error: mhash-0.9.9.9.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/mhash/mhash-0.9.9.9.tar.gz -fi - -if [ -s mcrypt-2.6.8.tar.gz ]; then - echo "mcrypt-2.6.8.tar.gz [found]" - else - echo "Error: mcrypt-2.6.8.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/mcrypt/mcrypt-2.6.8.tar.gz -fi - -if [ "$isinstallphp53" = "n" ]; then - if [ -s phpmyadmin-latest.tar.gz ]; then - echo "phpmyadmin-latest.tar.gz [found]" - else - echo "Error: phpmyadmin-latest.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/phpmyadmin/phpmyadmin-latest.tar.gz - fi -else - if [ -s phpMyAdmin-lasest.tar.gz ]; then - echo "phpMyAdmin-lasest.tar.gz [found]" - else - echo "Error: phpMyAdmin-lasest.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/phpmyadmin/phpMyAdmin-lasest.tar.gz - fi -fi - -if [ -s p.tar.gz ]; then - echo "p.tar.gz [found]" - else - echo "Error: p.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/prober/p.tar.gz -fi - -if [ -s autoconf-2.13.tar.gz ]; then - echo "autoconf-2.13.tar.gz [found]" - else - echo "Error: autoconf-2.13.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/lib/autoconf/autoconf-2.13.tar.gz -fi - -if [ -s mysql-openssl.patch ]; then - echo "mysql-openssl.patch [found]" - else - echo "Error: mysql-openssl.patch not found!!!download now......" - wget -c http://soft.vpser.net/lnmp/ext/mysql-openssl.patch -fi -echo "============================check files==================================" -} - -function InstallDependsAndOpt() -{ -cd $cur_dir - -tar zxf autoconf-2.13.tar.gz -cd autoconf-2.13/ -./configure --prefix=/usr/local/autoconf-2.13 -make && make install -cd ../ - -tar zxf libiconv-1.14.tar.gz -cd libiconv-1.14/ -./configure -make && make install -cd ../ - -cd $cur_dir -tar zxf libmcrypt-2.5.8.tar.gz -cd libmcrypt-2.5.8/ -./configure -make && make install -/sbin/ldconfig -cd libltdl/ -./configure --enable-ltdl-install -make && make install -cd ../../ - -cd $cur_dir -tar zxf mhash-0.9.9.9.tar.gz -cd mhash-0.9.9.9/ -./configure -make && make install -cd ../ - -ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la -ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so -ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 -ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 -ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a -ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la -ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so -ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 -ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 - -cd $cur_dir -tar zxf mcrypt-2.6.8.tar.gz -cd mcrypt-2.6.8/ -./configure -make && make install -cd ../ - -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - ln -s /usr/lib64/libpng.* /usr/lib/ - ln -s /usr/lib64/libjpeg.* /usr/lib/ -fi - -ulimit -v unlimited - -if [ ! `grep -l "/lib" '/etc/ld.so.conf'` ]; then - echo "/lib" >> /etc/ld.so.conf -fi - -if [ ! `grep -l '/usr/lib' '/etc/ld.so.conf'` ]; then - echo "/usr/lib" >> /etc/ld.so.conf -fi - -if [ -d "/usr/lib64" ] && [ ! `grep -l '/usr/lib64' '/etc/ld.so.conf'` ]; then - echo "/usr/lib64" >> /etc/ld.so.conf -fi - -if [ ! `grep -l '/usr/local/lib' '/etc/ld.so.conf'` ]; then - echo "/usr/local/lib" >> /etc/ld.so.conf -fi - -ldconfig - -cat >>/etc/security/limits.conf<> /etc/sysctl.conf -} - -function InstallMySQL51() -{ -echo "============================Install MySQL 5.1.73==================================" -cd $cur_dir -rm -f /etc/my.cnf -tar zxf mysql-5.1.73.tar.gz -cd mysql-5.1.73/ -if [ $installinnodb = "y" ]; then -./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase -else -./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile -fi -make && make install -cd ../ - -groupadd mysql -useradd -s /sbin/nologin -M -g mysql mysql - -cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf -sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf -if [ $installinnodb = "y" ]; then -sed -i 's:#innodb:innodb:g' /etc/my.cnf -fi -/usr/local/mysql/bin/mysql_install_db --user=mysql -chown -R mysql /usr/local/mysql/var -chgrp -R mysql /usr/local/mysql/. -cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql -chmod 755 /etc/init.d/mysql - -cat > /etc/ld.so.conf.d/mysql.conf< /tmp/mysql_sec_script< /etc/ld.so.conf.d/mysql.conf< /tmp/mysql_sec_script< /etc/ld.so.conf.d/mariadb.conf< /tmp/mariadb_sec_script<>/usr/local/php/etc/php.ini<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf</home/wwwroot/default/phpinfo.php< -eof - -echo "Copy PHP Prober..." -cd $cur_dir -tar zxvf p.tar.gz -cp p.php /home/wwwroot/default/p.php - -cp conf/index.html /home/wwwroot/default/index.html -echo "============================Install PHPMyAdmin=================================" -if [ "$isinstallphp53" = "n" ]; then - tar zxf phpmyadmin-latest.tar.gz - mv phpMyAdmin-3.4.8-all-languages /home/wwwroot/default/phpmyadmin -else - tar zxf phpMyAdmin-lasest.tar.gz - mv phpMyAdmin-*-all-languages /home/wwwroot/default/phpmyadmin -fi -cp conf/config.inc.php /home/wwwroot/default/phpmyadmin/config.inc.php -sed -i 's/LNMPORG/LNMP.org'$RANDOM'VPSer.net/g' /home/wwwroot/default/phpmyadmin/config.inc.php -mkdir /home/wwwroot/default/phpmyadmin/upload/ -mkdir /home/wwwroot/default/phpmyadmin/save/ -chmod 755 -R /home/wwwroot/default/phpmyadmin/ -chown www:www -R /home/wwwroot/default/phpmyadmin/ -echo "============================phpMyAdmin install completed=================================" -} - -function AddAndStartup() -{ -echo "============================add nginx and php-fpm on startup============================" -echo "Download new nginx init.d file......" -wget -c http://soft.vpser.net/lnmp/ext/init.d.nginx -cp init.d.nginx /etc/init.d/nginx -chmod +x /etc/init.d/nginx - -chkconfig --level 345 php-fpm on -chkconfig --level 345 nginx on -if [ "$isinstallmysql55" = "md" ]; then - chkconfig --level 345 mariadb on -else - chkconfig --level 345 mysql on -fi - -if [ "$isinstallmysql55" = "md" ]; then - sed -i 's:/etc/init.d/mysql:/etc/init.d/mariadb:g' /root/lnmp -fi -echo "===========================add nginx and php-fpm on startup completed====================" -echo "Starting LNMP..." -if [ "$isinstallmysql55" = "md" ]; then - /etc/init.d/mariadb start -else - /etc/init.d/mysql start -fi -/etc/init.d/php-fpm start -/etc/init.d/nginx start - -#add iptables firewall rules -if [ -s /sbin/iptables ]; then -/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT -/sbin/iptables -I INPUT -p tcp --dport 3306 -j DROP -/sbin/iptables-save -fi -} - -function CheckInstall() -{ -echo "===================================== Check install ===================================" -clear -isnginx="" -ismysql="" -isphp="" -echo "Checking..." -if [ -s /usr/local/nginx/conf/nginx.conf ] && [ -s /usr/local/nginx/sbin/nginx ]; then - echo "Nginx: OK" - isnginx="ok" - else - echo "Error: /usr/local/nginx not found!!!Nginx install failed." -fi - -if [ "$isinstallmysql55" = "md" ]; then - if [ -s /usr/local/mariadb/bin/mysql ] && [ -s /usr/local/mariadb/bin/mysqld_safe ] && [ -s /etc/my.cnf ]; then - echo "MariaDB: OK" - ismysql="ok" - else - echo "Error: /usr/local/mariadb not found!!!MySQL install failed." - fi -else - if [ -s /usr/local/mysql/bin/mysql ] && [ -s /usr/local/mysql/bin/mysqld_safe ] && [ -s /etc/my.cnf ]; then - echo "MySQL: OK" - ismysql="ok" - else - echo "Error: /usr/local/mysql not found!!!MySQL install failed." - fi -fi - -if [ -s /usr/local/php/sbin/php-fpm ] && [ -s /usr/local/php/etc/php.ini ] && [ -s /usr/local/php/bin/php ]; then - echo "PHP: OK" - echo "PHP-FPM: OK" - isphp="ok" - else - echo "Error: /usr/local/php not found!!!PHP install failed." -fi -if [ "$isnginx" = "ok" ] && [ "$ismysql" = "ok" ] && [ "$isphp" = "ok" ]; then -echo "Install lnmp 1.1 completed! enjoy it." -echo "=========================================================================" -echo "LNMP V1.1 for CentOS/RadHat Linux Server, Written by Licess " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "lnmp status manage: /root/lnmp {start|stop|reload|restart|kill|status}" -echo "default mysql root password:$mysqlrootpwd" -echo "phpinfo : http://yourIP/phpinfo.php" -echo "phpMyAdmin : http://yourIP/phpmyadmin/" -echo "Prober : http://yourIP/p.php" -echo "Add VirtualHost : /root/vhost.sh" -echo "" -echo "The path of some dirs:" -echo "mysql dir: /usr/local/mysql" -echo "php dir: /usr/local/php" -echo "nginx dir: /usr/local/nginx" -echo "web dir : /home/wwwroot/default" -echo "" -echo "=========================================================================" -/root/lnmp status -netstat -ntl -else -echo "Sorry,Failed to install LNMP!" -echo "Please visit http://bbs.vpser.net/forum-25-1.html feedback errors and logs." -echo "You can download /root/lnmp-install.log from your server,and upload lnmp-install.log to LNMP Forum." -fi -} - -InitInstall 2>&1 | tee /root/lnmp-install.log -CheckAndDownloadFiles 2>&1 | tee -a /root/lnmp-install.log -InstallDependsAndOpt 2>&1 | tee -a /root/lnmp-install.log -if [ "$isinstallmysql55" = "n" ]; then - InstallMySQL51 2>&1 | tee -a /root/lnmp-install.log -elif [ "$isinstallmysql55" = "y" ]; then - InstallMySQL55 2>&1 | tee -a /root/lnmp-install.log -else - InstallMariaDB 2>&1 | tee -a /root/lnmp-install.log -fi -if [ "$isinstallphp53" = "n" ]; then - InstallPHP52 2>&1 | tee -a /root/lnmp-install.log -else - InstallPHP53 2>&1 | tee -a /root/lnmp-install.log -fi -InstallNginx 2>&1 | tee -a /root/lnmp-install.log -CreatPHPTools 2>&1 | tee -a /root/lnmp-install.log -AddAndStartup 2>&1 | tee -a /root/lnmp-install.log -CheckInstall 2>&1 | tee -a /root/lnmp-install.log \ No newline at end of file diff --git a/conf/CentOS-Base-163.repo b/conf/CentOS-Base-163.repo new file mode 100644 index 00000000..af5952e8 --- /dev/null +++ b/conf/CentOS-Base-163.repo @@ -0,0 +1,52 @@ +# CentOS-Base.repo +# +# The mirror system uses the connecting IP address of the client and the +# update status of each mirror to pick mirrors that are updated to and +# geographically close to the client. You should use this for CentOS updates +# unless you are manually picking other mirrors. +# +# If the mirrorlist= does not work for you, as a fall back you can try the +# remarked out baseurl= line instead. +# +# + +[base] +name=CentOS-$releasever - Base - 163.com +baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os +gpgcheck=1 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 + +#released updates +[updates] +name=CentOS-$releasever - Updates - 163.com +baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates +gpgcheck=1 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 + +#additional packages that may be useful +[extras] +name=CentOS-$releasever - Extras - 163.com +baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras +gpgcheck=1 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 + +#additional packages that extend functionality of existing packages +[centosplus] +name=CentOS-$releasever - Plus - 163.com +baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus +gpgcheck=1 +enabled=0 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 + +#contrib - packages by Centos Users +[contrib] +name=CentOS-$releasever - Contrib - 163.com +baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/ +#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib +gpgcheck=1 +enabled=0 +gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 diff --git a/conf/config.inc.php b/conf/config.inc.php index 9f1b67ad..fdf5d841 100644 --- a/conf/config.inc.php +++ b/conf/config.inc.php @@ -149,4 +149,5 @@ * You can find more configuration options in the documentation * in the doc/ folder or at . */ +$cfg['VersionCheck'] = false; ?> \ No newline at end of file diff --git a/conf/enable-php-pathinfo.conf b/conf/enable-php-pathinfo.conf new file mode 100644 index 00000000..619732cc --- /dev/null +++ b/conf/enable-php-pathinfo.conf @@ -0,0 +1,7 @@ + location ~ [^/]\.php(/|$) + { + fastcgi_pass unix:/tmp/php-cgi.sock; + fastcgi_index index.php; + include fastcgi.conf; + include pathinfo.conf; + } \ No newline at end of file diff --git a/conf/enable-php.conf b/conf/enable-php.conf new file mode 100644 index 00000000..fcce5f39 --- /dev/null +++ b/conf/enable-php.conf @@ -0,0 +1,7 @@ + location ~ [^/]\.php(/|$) + { + try_files $uri =404; + fastcgi_pass unix:/tmp/php-cgi.sock; + fastcgi_index index.php; + include fastcgi.conf; + } \ No newline at end of file diff --git a/conf/enable-ssl-example.conf b/conf/enable-ssl-example.conf new file mode 100644 index 00000000..a3d1adb6 --- /dev/null +++ b/conf/enable-ssl-example.conf @@ -0,0 +1,44 @@ +server + { + listen 443 ssl spdy; + #listen [::]:443 ssl spdy; + server_name lnmp.org www.lnmp.org; + index index.html index.htm index.php default.html default.htm default.php; + root /home/wwwroot/lnmp.org; + ssl on; + ssl_certificate /home/ssl/lnmp.org/ssl.crt; + ssl_certificate_key /home/ssl/lnmp.org/ssl.key; + ssl_session_timeout 5m; + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-RC4-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:RC4-SHA:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS; + ssl_session_cache builtin:1000 shared:SSL:10m; + + #error_page 404 /404.html; + include enable-php.conf; + + location /nginx_status + { + stub_status on; + access_log off; + } + + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ + { + expires 30d; + } + + location ~ .*\.(js|css)?$ + { + expires 12h; + } + + access_log /home/wwwlogs/lnmp.log access; +} + +server + { + listen 80; + server_name lnmp.org www.lnmp.org; + return 301 https://lnmp.org$request_uri; +} \ No newline at end of file diff --git a/conf/httpd-default.conf b/conf/httpd-default.conf index 5495d2bc..e04c8d9f 100644 --- a/conf/httpd-default.conf +++ b/conf/httpd-default.conf @@ -13,7 +13,7 @@ Timeout 300 # KeepAlive: Whether or not to allow persistent connections (more than # one request per connection). Set to "Off" to deactivate. # -KeepAlive On +KeepAlive Off # # MaxKeepAliveRequests: The maximum number of requests to allow @@ -26,7 +26,7 @@ MaxKeepAliveRequests 1000 # KeepAliveTimeout: Number of seconds to wait for the next request from the # same client on the same connection. # -KeepAliveTimeout 5 +KeepAliveTimeout 15 # # UseCanonicalName: Determines how Apache constructs self-referencing @@ -52,7 +52,7 @@ AccessFileName .htaccess # Set to one of: Full | OS | Minor | Minimal | Major | Prod # where Full conveys the most information, and Prod the least. # -ServerTokens Full +ServerTokens Prod # # Optionally add a line containing the server version and virtual host @@ -73,3 +73,7 @@ ServerSignature On # nameserver. # HostnameLookups Off + +AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml text/javascript +DeflateCompressionLevel 6 +SetOutputFilter DEFLATE \ No newline at end of file diff --git a/conf/httpd-mpm.conf b/conf/httpd-mpm.conf deleted file mode 100644 index a63dd848..00000000 --- a/conf/httpd-mpm.conf +++ /dev/null @@ -1,110 +0,0 @@ -# -# Server-Pool Management (MPM specific) -# - -# -# PidFile: The file in which the server should record its process -# identification number when it starts. -# -# Note that this is the default PidFile for most MPMs. -# - - PidFile "logs/httpd.pid" - - -# -# The accept serialization lock file MUST BE STORED ON A LOCAL DISK. -# - - -LockFile "logs/accept.lock" - - - -# -# Only one of the below sections will be relevant on your -# installed httpd. Use "apachectl -l" to find out the -# active mpm. -# - -# prefork MPM -# StartServers: number of server processes to start -# MinSpareServers: minimum number of server processes which are kept spare -# MaxSpareServers: maximum number of server processes which are kept spare -# MaxClients: maximum number of server processes allowed to start -# MaxRequestsPerChild: maximum number of requests a server process serves - - StartServers 5 - MinSpareServers 5 - MaxSpareServers 10 - MaxClients 150 - MaxRequestsPerChild 0 - - -# worker MPM -# StartServers: initial number of server processes to start -# MaxClients: maximum number of simultaneous client connections -# MinSpareThreads: minimum number of worker threads which are kept spare -# MaxSpareThreads: maximum number of worker threads which are kept spare -# ThreadsPerChild: constant number of worker threads in each server process -# MaxRequestsPerChild: maximum number of requests a server process serves - - StartServers 2 - MaxClients 150 - MinSpareThreads 25 - MaxSpareThreads 75 - ThreadsPerChild 25 - MaxRequestsPerChild 1000 - - -# BeOS MPM -# StartThreads: how many threads do we initially spawn? -# MaxClients: max number of threads we can have (1 thread == 1 client) -# MaxRequestsPerThread: maximum number of requests each thread will process - - StartThreads 10 - MaxClients 50 - MaxRequestsPerThread 10000 - - -# NetWare MPM -# ThreadStackSize: Stack size allocated for each worker thread -# StartThreads: Number of worker threads launched at server startup -# MinSpareThreads: Minimum number of idle threads, to handle request spikes -# MaxSpareThreads: Maximum number of idle threads -# MaxThreads: Maximum number of worker threads alive at the same time -# MaxRequestsPerChild: Maximum number of requests a thread serves. It is -# recommended that the default value of 0 be set for this -# directive on NetWare. This will allow the thread to -# continue to service requests indefinitely. - - ThreadStackSize 65536 - StartThreads 250 - MinSpareThreads 25 - MaxSpareThreads 250 - MaxThreads 1000 - MaxRequestsPerChild 0 - MaxMemFree 100 - - -# OS/2 MPM -# StartServers: Number of server processes to maintain -# MinSpareThreads: Minimum number of idle threads per process, -# to handle request spikes -# MaxSpareThreads: Maximum number of idle threads per process -# MaxRequestsPerChild: Maximum number of connections per server process - - StartServers 2 - MinSpareThreads 5 - MaxSpareThreads 10 - MaxRequestsPerChild 0 - - -# WinNT MPM -# ThreadsPerChild: constant number of worker threads in the server process -# MaxRequestsPerChild: maximum number of requests a server process serves - - ThreadsPerChild 150 - MaxRequestsPerChild 0 - - diff --git a/conf/httpd-vhosts-lamp.conf b/conf/httpd-vhosts-lamp.conf new file mode 100644 index 00000000..3ddc8287 --- /dev/null +++ b/conf/httpd-vhosts-lamp.conf @@ -0,0 +1,29 @@ +# +# Virtual Hosts +# +# If you want to maintain multiple domains/hostnames on your +# machine you can setup VirtualHost containers for them. Most configurations +# use only name-based virtual hosts so the server doesn't need to worry about +# IP addresses. This is indicated by the asterisks in the directives below. +# +# Please see the documentation at +# +# for further details before you try to setup virtual hosts. +# +# You may use the command line option '-S' to verify your virtual host +# configuration. + +# +# VirtualHost example: +# Almost any Apache directive may go into a VirtualHost container. +# The first VirtualHost section is used for all requests that do not +# match a ServerName or ServerAlias in any block. +# + +ServerAdmin webmaster@example.com +#php_admin_value open_basedir "/home/wwwroot/default:/tmp/:/var/tmp/:/proc/" +DocumentRoot "/home/wwwroot/default" +ServerName www.lnmp.org +ErrorLog "/home/wwwlogs/IP-error_log" +CustomLog "/home/wwwlogs/IP-access_log" common + diff --git a/conf/httpd-vhosts.conf b/conf/httpd-vhosts-lnmpa.conf similarity index 88% rename from conf/httpd-vhosts.conf rename to conf/httpd-vhosts-lnmpa.conf index 3c731cbf..5feafcc0 100644 --- a/conf/httpd-vhosts.conf +++ b/conf/httpd-vhosts-lnmpa.conf @@ -13,11 +13,6 @@ # You may use the command line option '-S' to verify your virtual host # configuration. -# -# Use name-based virtual hosting. -# -NameVirtualHost *:88 - # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. @@ -29,6 +24,6 @@ ServerAdmin webmaster@example.com #php_admin_value open_basedir "/home/wwwroot/default:/tmp/:/var/tmp/:/proc/" DocumentRoot "/home/wwwroot/default" ServerName www.lnmp.org -ErrorLog "logs/IP-error_log" -CustomLog "logs/IP-access_log" common +ErrorLog "/home/wwwlogs/IP-error_log" +CustomLog "/home/wwwlogs/IP-access_log" common diff --git a/conf/httpd.conf b/conf/httpd22-lamp.conf similarity index 76% rename from conf/httpd.conf rename to conf/httpd22-lamp.conf index 85bd6e2e..105bc71a 100644 --- a/conf/httpd.conf +++ b/conf/httpd22-lamp.conf @@ -1,3 +1,4 @@ +# # This is the main Apache HTTP server configuration file. It contains the # configuration directives that give the server its instructions. # See for detailed information. @@ -12,9 +13,11 @@ # Configuration and logfile names: If the filenames you specify for many # of the server's control files begin with "/" (or "drive:/" for Win32), the # server will use that explicit path. If the filenames do *not* begin -# with "/", the value of ServerRoot is prepended -- so "logs/foo_log" -# with ServerRoot set to "/usr/local/apache" will be interpreted by the -# server as "/usr/local/apache/logs/foo_log". +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' +# with ServerRoot set to '/www' will be interpreted by the +# server as '/www/log/access_log', where as '/log/access_log' will be +# interpreted as '/log/access_log'. + # # ServerRoot: The top of the directory tree under which the server's # configuration, error, and log files are kept. @@ -25,6 +28,7 @@ # httpd daemons, you will need to change at least LockFile and PidFile. # ServerRoot "/usr/local/apache" + # # Listen: Allows you to bind Apache to specific IP addresses and/or # ports, instead of the default. See also the @@ -34,7 +38,8 @@ ServerRoot "/usr/local/apache" # prevent Apache from glomming onto all bound IP addresses. # #Listen 12.34.56.78:80 -Listen 127.0.0.1:88 +Listen 80 + # # Dynamic Shared Object (DSO) Support # @@ -47,6 +52,63 @@ Listen 127.0.0.1:88 # Example: # LoadModule foo_module modules/mod_foo.so # +LoadModule authn_file_module modules/mod_authn_file.so +LoadModule authn_dbm_module modules/mod_authn_dbm.so +LoadModule authn_anon_module modules/mod_authn_anon.so +LoadModule authn_dbd_module modules/mod_authn_dbd.so +LoadModule authn_default_module modules/mod_authn_default.so +LoadModule authz_host_module modules/mod_authz_host.so +LoadModule authz_groupfile_module modules/mod_authz_groupfile.so +LoadModule authz_user_module modules/mod_authz_user.so +LoadModule authz_dbm_module modules/mod_authz_dbm.so +LoadModule authz_owner_module modules/mod_authz_owner.so +LoadModule authz_default_module modules/mod_authz_default.so +LoadModule auth_basic_module modules/mod_auth_basic.so +LoadModule auth_digest_module modules/mod_auth_digest.so +LoadModule dbd_module modules/mod_dbd.so +LoadModule dumpio_module modules/mod_dumpio.so +LoadModule reqtimeout_module modules/mod_reqtimeout.so +LoadModule ext_filter_module modules/mod_ext_filter.so +LoadModule include_module modules/mod_include.so +LoadModule filter_module modules/mod_filter.so +LoadModule substitute_module modules/mod_substitute.so +LoadModule deflate_module modules/mod_deflate.so +LoadModule log_config_module modules/mod_log_config.so +LoadModule logio_module modules/mod_logio.so +LoadModule env_module modules/mod_env.so +LoadModule mime_magic_module modules/mod_mime_magic.so +LoadModule expires_module modules/mod_expires.so +LoadModule headers_module modules/mod_headers.so +LoadModule ident_module modules/mod_ident.so +LoadModule setenvif_module modules/mod_setenvif.so +LoadModule version_module modules/mod_version.so +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_connect_module modules/mod_proxy_connect.so +LoadModule proxy_ftp_module modules/mod_proxy_ftp.so +LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule proxy_scgi_module modules/mod_proxy_scgi.so +LoadModule proxy_ajp_module modules/mod_proxy_ajp.so +LoadModule proxy_balancer_module modules/mod_proxy_balancer.so +LoadModule ssl_module modules/mod_ssl.so +LoadModule mime_module modules/mod_mime.so +LoadModule dav_module modules/mod_dav.so +LoadModule status_module modules/mod_status.so +LoadModule autoindex_module modules/mod_autoindex.so +LoadModule asis_module modules/mod_asis.so +LoadModule info_module modules/mod_info.so +LoadModule suexec_module modules/mod_suexec.so +LoadModule cgi_module modules/mod_cgi.so +LoadModule dav_fs_module modules/mod_dav_fs.so +LoadModule vhost_alias_module modules/mod_vhost_alias.so +LoadModule negotiation_module modules/mod_negotiation.so +LoadModule dir_module modules/mod_dir.so +LoadModule imagemap_module modules/mod_imagemap.so +LoadModule actions_module modules/mod_actions.so +LoadModule speling_module modules/mod_speling.so +LoadModule userdir_module modules/mod_userdir.so +LoadModule alias_module modules/mod_alias.so +LoadModule rewrite_module modules/mod_rewrite.so + # @@ -59,8 +121,10 @@ Listen 127.0.0.1:88 # User www Group www + + # 'Main' server configuration # # The directives in this section set up the values used by the 'main' @@ -72,12 +136,14 @@ Group www # in which case these default settings will be overridden for the # virtual host being defined. # + # # ServerAdmin: Your address, where problems with the server should be # e-mailed. This address appears on some server-generated pages, such # as error documents. e.g. admin@your-domain.com # ServerAdmin you@example.com + # # ServerName gives the name and port that the server uses to identify itself. # This can often be determined automatically, but we recommend you specify @@ -85,13 +151,15 @@ ServerAdmin you@example.com # # If your host doesn't have a registered DNS name, enter its IP address here. # -#ServerName www.example.com:80 +ServerName 0.0.0.0:80 + # # DocumentRoot: The directory out of which you will serve your # documents. By default, all requests are taken from this directory, but # symbolic links and aliases may be used to point to other locations. # DocumentRoot "/home/wwwroot/default" + # # Each directory to which Apache has access can be configured with respect # to which services and features are allowed and/or disabled in that @@ -101,17 +169,19 @@ DocumentRoot "/home/wwwroot/default" # features. # - Options ExecCGI FollowSymLinks Includes IncludesNOEXEC -Indexes -MultiViews SymLinksIfOwnerMatch + Options FollowSymLinks AllowOverride All - Order allow,deny - Allow from all + Order deny,allow + Deny from all + # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. # + # # This should be changed to whatever you set DocumentRoot to. # @@ -128,26 +198,31 @@ DocumentRoot "/home/wwwroot/default" # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # - Options Indexes -Indexes FollowSymLinks + Options FollowSymLinks + # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All + # # Controls who can get stuff from this server. # Order allow,deny Allow from all + + # # DirectoryIndex: sets the file that Apache will serve if a directory # is requested. # - DirectoryIndex index.html index.htm index.shtml index.php index.perl index.pl index.cgi + DirectoryIndex index.html index.htm index.php + # # The following lines prevent .htaccess and .htpasswd files from being # viewed by Web clients. @@ -157,6 +232,7 @@ DocumentRoot "/home/wwwroot/default" Deny from all Satisfy All + # # ErrorLog: The location of the error log file. # If you do not specify an ErrorLog directive within a @@ -164,13 +240,15 @@ DocumentRoot "/home/wwwroot/default" # logged here. If you *do* define an error logfile for a # container, that host's errors will be logged there and not here. # -ErrorLog "logs/error_log" +ErrorLog "/home/wwwlogs/error_log" + # # LogLevel: Control the number of messages logged to the error_log. # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. # LogLevel warn + # # The following directives define some format nicknames for use with @@ -178,10 +256,12 @@ LogLevel warn # LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined LogFormat "%h %l %u %t \"%r\" %>s %b" common + # You need to enable mod_logio.c to use %I and %O LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio + # # The location and format of the access logfile (Common Logfile Format). # If you do not define any access logfiles within a @@ -189,13 +269,15 @@ LogLevel warn # define per- access logfiles, transactions will be # logged therein and *not* in this file. # - CustomLog "logs/access_log" common + CustomLog "/home/wwwlogs/access_log" common + # # If you prefer a logfile with access, agent, and referer information # (Combined Logfile Format) you can use the following directive. # #CustomLog "logs/access_log" combined + # # Redirect: Allows you to tell clients about documents that used to @@ -203,6 +285,7 @@ LogLevel warn # will make a new request for the document at its new location. # Example: # Redirect permanent /foo http://www.example.com/bar + # # Alias: Maps web paths into filesystem paths and is used to # access content that does not live under the DocumentRoot. @@ -213,6 +296,7 @@ LogLevel warn # require it to be present in the URL. You will also likely # need to provide a section to allow access to # the filesystem path. + # # ScriptAlias: This controls which directories contain server scripts. # ScriptAliases are essentially the same as Aliases, except that @@ -222,7 +306,9 @@ LogLevel warn # directives as to Alias. # ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" + + # # ScriptSock: On threaded servers, designate the path to the UNIX @@ -230,16 +316,18 @@ LogLevel warn # #Scriptsock logs/cgisock + # # "/usr/local/apache/cgi-bin" should be changed to whatever your ScriptAliased # CGI directory exists, if you have that configured. # - AllowOverride None + AllowOverride All Options None Order allow,deny Allow from all + # # DefaultType: the default MIME type the server will use for a document # if it cannot otherwise determine one, such as from filename extensions. @@ -250,16 +338,14 @@ LogLevel warn # text. # DefaultType text/plain -RewriteEngine on -AddType text/html .shtml -AddHandler cgi-script .cgi .pl .plx .ppl .perl -AddHandler server-parsed .shtml + # # TypesConfig points to the file containing the list of mappings from # filename extension to MIME-type. # TypesConfig conf/mime.types + # # AddType allows you to add to or override the MIME configuration # file specified in TypesConfig for specific file types. @@ -277,6 +363,9 @@ AddHandler server-parsed .shtml # AddType application/x-compress .Z AddType application/x-gzip .gz .tgz + AddType application/x-httpd-php .php + AddType application/x-httpd-php-source .phps + # # AddHandler allows you to map certain file extensions to "handlers": # actions unrelated to filetype. These can be either built into the server @@ -286,8 +375,10 @@ AddHandler server-parsed .shtml # (You will also need to add "ExecCGI" to the "Options" directive.) # #AddHandler cgi-script .cgi + # For type maps (negotiated resources): #AddHandler type-map var + # # Filters allow you to process content before it is sent to the client. # @@ -296,29 +387,15 @@ AddHandler server-parsed .shtml # #AddType text/html .shtml #AddOutputFilter INCLUDES .shtml - AddType application/perl .pl .plx .ppl .perl - AddType application/x-img .img - AddType application/x-httpd-php .php .php3 .php4 .php5 .php6 - AddType application/x-httpd-php-source .phps - AddType application/cgi .cgi - AddType text/x-sql .sql - AddType text/x-log .log - AddType text/x-config .cnf conf - AddType text/x-registry .reg - AddType text/html .shtml - AddType application/x-tar .tgz - AddType application/rar .rar - AddType application/x-compressed .rar - AddType application/x-rar .rar - AddType application/x-rar-compressed .rar - AddType text/vnd.wap.wml .wml + # # The mod_mime_magic module allows the server to use various hints from the # contents of the file itself to determine its type. The MIMEMagicFile # directive tells the module where the hint definitions are located. # #MIMEMagicFile conf/magic + # # Customizable error responses come in three flavors: # 1) plain text 2) local redirects 3) external redirects @@ -329,6 +406,14 @@ AddHandler server-parsed .shtml #ErrorDocument 404 "/cgi-bin/missing_handler.pl" #ErrorDocument 402 http://www.example.com/subscription_info.html # + +# +# MaxRanges: Maximum number of Ranges in a request before +# returning the entire resource, or one of the special +# values 'default', 'none' or 'unlimited'. +# Default setting is to accept 200 Ranges. +#MaxRanges unlimited + # # EnableMMAP and EnableSendfile: On systems that support it, # memory-mapping or the sendfile syscall is used to deliver @@ -339,9 +424,7 @@ AddHandler server-parsed .shtml # #EnableMMAP off #EnableSendfile off -# LoadModule perl_module modules/mod_perl.so LoadModule php5_module modules/libphp5.so -Include conf/extra/rpaf.conf # Supplemental configuration # @@ -349,26 +432,37 @@ Include conf/extra/rpaf.conf # included to add extra features or to modify the default configuration of # the server, or you may simply copy their contents here and change as # necessary. + # Server-pool management (MPM specific) Include conf/extra/httpd-mpm.conf + # Multi-language error messages -Include conf/extra/httpd-multilang-errordoc.conf +#Include conf/extra/httpd-multilang-errordoc.conf + # Fancy directory listings -Include conf/extra/httpd-autoindex.conf +#Include conf/extra/httpd-autoindex.conf + # Language settings -Include conf/extra/httpd-languages.conf +#Include conf/extra/httpd-languages.conf + # User home directories #Include conf/extra/httpd-userdir.conf + # Real-time info on requests and configuration -Include conf/extra/httpd-info.conf +#Include conf/extra/httpd-info.conf + # Virtual hosts Include conf/extra/httpd-vhosts.conf + # Local access to the Apache HTTP Server Manual #Include conf/extra/httpd-manual.conf + # Distributed authoring and versioning (WebDAV) #Include conf/extra/httpd-dav.conf + # Various default settings Include conf/extra/httpd-default.conf + # Secure (SSL/TLS) connections #Include conf/extra/httpd-ssl.conf # @@ -376,5 +470,9 @@ Include conf/extra/httpd-default.conf # starting without SSL on platforms with no /dev/random equivalent # but a statically compiled-in mod_ssl. # + +SSLRandomSeed startup builtin +SSLRandomSeed connect builtin + Include conf/vhost/*.conf diff --git a/conf/httpd22-lnmpa.conf b/conf/httpd22-lnmpa.conf new file mode 100644 index 00000000..3ed09b96 --- /dev/null +++ b/conf/httpd22-lnmpa.conf @@ -0,0 +1,479 @@ +# +# This is the main Apache HTTP server configuration file. It contains the +# configuration directives that give the server its instructions. +# See for detailed information. +# In particular, see +# +# for a discussion of each configuration directive. +# +# Do NOT simply read the instructions in here without understanding +# what they do. They're here only as hints or reminders. If you are unsure +# consult the online docs. You have been warned. +# +# Configuration and logfile names: If the filenames you specify for many +# of the server's control files begin with "/" (or "drive:/" for Win32), the +# server will use that explicit path. If the filenames do *not* begin +# with "/", the value of ServerRoot is prepended -- so 'log/access_log' +# with ServerRoot set to '/www' will be interpreted by the +# server as '/www/log/access_log', where as '/log/access_log' will be +# interpreted as '/log/access_log'. + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# Do not add a slash at the end of the directory path. If you point +# ServerRoot at a non-local disk, be sure to point the LockFile directive +# at a local disk. If you wish to share the same ServerRoot for multiple +# httpd daemons, you will need to change at least LockFile and PidFile. +# +ServerRoot "/usr/local/apache" + +# +# Listen: Allows you to bind Apache to specific IP addresses and/or +# ports, instead of the default. See also the +# directive. +# +# Change this to Listen on specific IP addresses as shown below to +# prevent Apache from glomming onto all bound IP addresses. +# +#Listen 12.34.56.78:80 +Listen 127.0.0.1:88 + +# +# Dynamic Shared Object (DSO) Support +# +# To be able to use the functionality of a module which was built as a DSO you +# have to place corresponding `LoadModule' lines at this location so the +# directives contained in it are actually available _before_ they are used. +# Statically compiled modules (those listed by `httpd -l') do not need +# to be loaded here. +# +# Example: +# LoadModule foo_module modules/mod_foo.so +# +LoadModule authn_file_module modules/mod_authn_file.so +LoadModule authn_dbm_module modules/mod_authn_dbm.so +LoadModule authn_anon_module modules/mod_authn_anon.so +LoadModule authn_dbd_module modules/mod_authn_dbd.so +LoadModule authn_default_module modules/mod_authn_default.so +LoadModule authz_host_module modules/mod_authz_host.so +LoadModule authz_groupfile_module modules/mod_authz_groupfile.so +LoadModule authz_user_module modules/mod_authz_user.so +LoadModule authz_dbm_module modules/mod_authz_dbm.so +LoadModule authz_owner_module modules/mod_authz_owner.so +LoadModule authz_default_module modules/mod_authz_default.so +LoadModule auth_basic_module modules/mod_auth_basic.so +LoadModule auth_digest_module modules/mod_auth_digest.so +LoadModule dbd_module modules/mod_dbd.so +LoadModule dumpio_module modules/mod_dumpio.so +LoadModule reqtimeout_module modules/mod_reqtimeout.so +LoadModule ext_filter_module modules/mod_ext_filter.so +LoadModule include_module modules/mod_include.so +LoadModule filter_module modules/mod_filter.so +LoadModule substitute_module modules/mod_substitute.so +LoadModule deflate_module modules/mod_deflate.so +LoadModule log_config_module modules/mod_log_config.so +LoadModule logio_module modules/mod_logio.so +LoadModule env_module modules/mod_env.so +LoadModule mime_magic_module modules/mod_mime_magic.so +LoadModule expires_module modules/mod_expires.so +LoadModule headers_module modules/mod_headers.so +LoadModule ident_module modules/mod_ident.so +LoadModule setenvif_module modules/mod_setenvif.so +LoadModule version_module modules/mod_version.so +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_connect_module modules/mod_proxy_connect.so +LoadModule proxy_ftp_module modules/mod_proxy_ftp.so +LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule proxy_scgi_module modules/mod_proxy_scgi.so +LoadModule proxy_ajp_module modules/mod_proxy_ajp.so +LoadModule proxy_balancer_module modules/mod_proxy_balancer.so +LoadModule ssl_module modules/mod_ssl.so +LoadModule mime_module modules/mod_mime.so +LoadModule dav_module modules/mod_dav.so +LoadModule status_module modules/mod_status.so +LoadModule autoindex_module modules/mod_autoindex.so +LoadModule asis_module modules/mod_asis.so +LoadModule info_module modules/mod_info.so +LoadModule suexec_module modules/mod_suexec.so +LoadModule cgi_module modules/mod_cgi.so +LoadModule dav_fs_module modules/mod_dav_fs.so +LoadModule vhost_alias_module modules/mod_vhost_alias.so +LoadModule negotiation_module modules/mod_negotiation.so +LoadModule dir_module modules/mod_dir.so +LoadModule imagemap_module modules/mod_imagemap.so +LoadModule actions_module modules/mod_actions.so +LoadModule speling_module modules/mod_speling.so +LoadModule userdir_module modules/mod_userdir.so +LoadModule alias_module modules/mod_alias.so +LoadModule rewrite_module modules/mod_rewrite.so + + + +# +# If you wish httpd to run as a different user or group, you must run +# httpd as root initially and it will switch. +# +# User/Group: The name (or #number) of the user/group to run httpd as. +# It is usually good practice to create a dedicated user and group for +# running httpd, as with most system services. +# +User www +Group www + + + + +# 'Main' server configuration +# +# The directives in this section set up the values used by the 'main' +# server, which responds to any requests that aren't handled by a +# definition. These values also provide defaults for +# any containers you may define later in the file. +# +# All of these directives may appear inside containers, +# in which case these default settings will be overridden for the +# virtual host being defined. +# + +# +# ServerAdmin: Your address, where problems with the server should be +# e-mailed. This address appears on some server-generated pages, such +# as error documents. e.g. admin@your-domain.com +# +ServerAdmin you@example.com + +# +# ServerName gives the name and port that the server uses to identify itself. +# This can often be determined automatically, but we recommend you specify +# it explicitly to prevent problems during startup. +# +# If your host doesn't have a registered DNS name, enter its IP address here. +# +ServerName 127.0.0.1:88 + +# +# DocumentRoot: The directory out of which you will serve your +# documents. By default, all requests are taken from this directory, but +# symbolic links and aliases may be used to point to other locations. +# +DocumentRoot "/home/wwwroot/default" + +# +# Each directory to which Apache has access can be configured with respect +# to which services and features are allowed and/or disabled in that +# directory (and its subdirectories). +# +# First, we configure the "default" to be a very restrictive set of +# features. +# + + Options FollowSymLinks + AllowOverride All + Order deny,allow + Deny from all + + +# +# Note that from this point forward you must specifically allow +# particular features to be enabled - so if something's not working as +# you might expect, make sure that you have specifically enabled it +# below. +# + +# +# This should be changed to whatever you set DocumentRoot to. +# + + # + # Possible values for the Options directive are "None", "All", + # or any combination of: + # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews + # + # Note that "MultiViews" must be named *explicitly* --- "Options All" + # doesn't give it to you. + # + # The Options directive is both complicated and important. Please see + # http://httpd.apache.org/docs/2.2/mod/core.html#options + # for more information. + # + Options FollowSymLinks + + # + # AllowOverride controls what directives may be placed in .htaccess files. + # It can be "All", "None", or any combination of the keywords: + # Options FileInfo AuthConfig Limit + # + AllowOverride All + + # + # Controls who can get stuff from this server. + # + Order allow,deny + Allow from all + + + +# +# DirectoryIndex: sets the file that Apache will serve if a directory +# is requested. +# + + DirectoryIndex index.html index.htm index.php + + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Order allow,deny + Deny from all + Satisfy All + + +# +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog "/home/wwwlogs/error_log" + +# +# LogLevel: Control the number of messages logged to the error_log. +# Possible values include: debug, info, notice, warn, error, crit, +# alert, emerg. +# +LogLevel warn + + + # + # The following directives define some format nicknames for use with + # a CustomLog directive (see below). + # + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%h %l %u %t \"%r\" %>s %b" common + + + # You need to enable mod_logio.c to use %I and %O + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio + + + # + # The location and format of the access logfile (Common Logfile Format). + # If you do not define any access logfiles within a + # container, they will be logged here. Contrariwise, if you *do* + # define per- access logfiles, transactions will be + # logged therein and *not* in this file. + # + CustomLog "/home/wwwlogs/access_log" common + + # + # If you prefer a logfile with access, agent, and referer information + # (Combined Logfile Format) you can use the following directive. + # + #CustomLog "logs/access_log" combined + + + + # + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client + # will make a new request for the document at its new location. + # Example: + # Redirect permanent /foo http://www.example.com/bar + + # + # Alias: Maps web paths into filesystem paths and is used to + # access content that does not live under the DocumentRoot. + # Example: + # Alias /webpath /full/filesystem/path + # + # If you include a trailing / on /webpath then the server will + # require it to be present in the URL. You will also likely + # need to provide a section to allow access to + # the filesystem path. + + # + # ScriptAlias: This controls which directories contain server scripts. + # ScriptAliases are essentially the same as Aliases, except that + # documents in the target directory are treated as applications and + # run by the server when requested rather than as documents sent to the + # client. The same rules about trailing "/" apply to ScriptAlias + # directives as to Alias. + # + ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" + + + + + # + # ScriptSock: On threaded servers, designate the path to the UNIX + # socket used to communicate with the CGI daemon of mod_cgid. + # + #Scriptsock logs/cgisock + + +# +# "/usr/local/apache/cgi-bin" should be changed to whatever your ScriptAliased +# CGI directory exists, if you have that configured. +# + + AllowOverride All + Options None + Order allow,deny + Allow from all + + +# +# DefaultType: the default MIME type the server will use for a document +# if it cannot otherwise determine one, such as from filename extensions. +# If your server contains mostly text or HTML documents, "text/plain" is +# a good value. If most of your content is binary, such as applications +# or images, you may want to use "application/octet-stream" instead to +# keep browsers from trying to display binary files as though they are +# text. +# +DefaultType text/plain + + + # + # TypesConfig points to the file containing the list of mappings from + # filename extension to MIME-type. + # + TypesConfig conf/mime.types + + # + # AddType allows you to add to or override the MIME configuration + # file specified in TypesConfig for specific file types. + # + #AddType application/x-gzip .tgz + # + # AddEncoding allows you to have certain browsers uncompress + # information on the fly. Note: Not all browsers support this. + # + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + # + # If the AddEncoding directives above are commented-out, then you + # probably should define those extensions to indicate media types: + # + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + AddType application/x-httpd-php .php + AddType application/x-httpd-php-source .phps + + # + # AddHandler allows you to map certain file extensions to "handlers": + # actions unrelated to filetype. These can be either built into the server + # or added with the Action directive (see below) + # + # To use CGI scripts outside of ScriptAliased directories: + # (You will also need to add "ExecCGI" to the "Options" directive.) + # + #AddHandler cgi-script .cgi + + # For type maps (negotiated resources): + #AddHandler type-map var + + # + # Filters allow you to process content before it is sent to the client. + # + # To parse .shtml files for server-side includes (SSI): + # (You will also need to add "Includes" to the "Options" directive.) + # + #AddType text/html .shtml + #AddOutputFilter INCLUDES .shtml + + +# +# The mod_mime_magic module allows the server to use various hints from the +# contents of the file itself to determine its type. The MIMEMagicFile +# directive tells the module where the hint definitions are located. +# +#MIMEMagicFile conf/magic + +# +# Customizable error responses come in three flavors: +# 1) plain text 2) local redirects 3) external redirects +# +# Some examples: +#ErrorDocument 500 "The server made a boo boo." +#ErrorDocument 404 /missing.html +#ErrorDocument 404 "/cgi-bin/missing_handler.pl" +#ErrorDocument 402 http://www.example.com/subscription_info.html +# + +# +# MaxRanges: Maximum number of Ranges in a request before +# returning the entire resource, or one of the special +# values 'default', 'none' or 'unlimited'. +# Default setting is to accept 200 Ranges. +#MaxRanges unlimited + +# +# EnableMMAP and EnableSendfile: On systems that support it, +# memory-mapping or the sendfile syscall is used to deliver +# files. This usually improves server performance, but must +# be turned off when serving from networked-mounted +# filesystems or if support for these functions is otherwise +# broken on your system. +# +#EnableMMAP off +#EnableSendfile off +LoadModule php5_module modules/libphp5.so +Include conf/extra/mod_remoteip.conf + +# Supplemental configuration +# +# The configuration files in the conf/extra/ directory can be +# included to add extra features or to modify the default configuration of +# the server, or you may simply copy their contents here and change as +# necessary. + +# Server-pool management (MPM specific) +Include conf/extra/httpd-mpm.conf + +# Multi-language error messages +#Include conf/extra/httpd-multilang-errordoc.conf + +# Fancy directory listings +#Include conf/extra/httpd-autoindex.conf + +# Language settings +#Include conf/extra/httpd-languages.conf + +# User home directories +#Include conf/extra/httpd-userdir.conf + +# Real-time info on requests and configuration +#Include conf/extra/httpd-info.conf + +# Virtual hosts +Include conf/extra/httpd-vhosts.conf + +# Local access to the Apache HTTP Server Manual +#Include conf/extra/httpd-manual.conf + +# Distributed authoring and versioning (WebDAV) +#Include conf/extra/httpd-dav.conf + +# Various default settings +Include conf/extra/httpd-default.conf + +# Secure (SSL/TLS) connections +#Include conf/extra/httpd-ssl.conf +# +# Note: The following must must be present to support +# starting without SSL on platforms with no /dev/random equivalent +# but a statically compiled-in mod_ssl. +# + +SSLRandomSeed startup builtin +SSLRandomSeed connect builtin + + +Include conf/vhost/*.conf diff --git a/conf/httpd24-lamp.conf b/conf/httpd24-lamp.conf new file mode 100644 index 00000000..be7d14bd --- /dev/null +++ b/conf/httpd24-lamp.conf @@ -0,0 +1,509 @@ +# +# This is the main Apache HTTP server configuration file. It contains the +# configuration directives that give the server its instructions. +# See for detailed information. +# In particular, see +# +# for a discussion of each configuration directive. +# +# Do NOT simply read the instructions in here without understanding +# what they do. They're here only as hints or reminders. If you are unsure +# consult the online docs. You have been warned. +# +# Configuration and logfile names: If the filenames you specify for many +# of the server's control files begin with "/" (or "drive:/" for Win32), the +# server will use that explicit path. If the filenames do *not* begin +# with "/", the value of ServerRoot is prepended -- so "logs/access_log" +# with ServerRoot set to "/usr/local/apache2" will be interpreted by the +# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" +# will be interpreted as '/logs/access_log'. + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# Do not add a slash at the end of the directory path. If you point +# ServerRoot at a non-local disk, be sure to specify a local disk on the +# Mutex directive, if file-based mutexes are used. If you wish to share the +# same ServerRoot for multiple httpd daemons, you will need to change at +# least PidFile. +# +ServerRoot "/usr/local/apache" + +# +# Mutex: Allows you to set the mutex mechanism and mutex file directory +# for individual mutexes, or change the global defaults +# +# Uncomment and change the directory if mutexes are file-based and the default +# mutex file directory is not on a local disk or is not appropriate for some +# other reason. +# +# Mutex default:logs + +# +# Listen: Allows you to bind Apache to specific IP addresses and/or +# ports, instead of the default. See also the +# directive. +# +# Change this to Listen on specific IP addresses as shown below to +# prevent Apache from glomming onto all bound IP addresses. +# +#Listen 12.34.56.78:80 +Listen 80 + +# +# Dynamic Shared Object (DSO) Support +# +# To be able to use the functionality of a module which was built as a DSO you +# have to place corresponding `LoadModule' lines at this location so the +# directives contained in it are actually available _before_ they are used. +# Statically compiled modules (those listed by `httpd -l') do not need +# to be loaded here. +# +# Example: +# LoadModule foo_module modules/mod_foo.so +# +LoadModule authn_file_module modules/mod_authn_file.so +#LoadModule authn_dbm_module modules/mod_authn_dbm.so +#LoadModule authn_anon_module modules/mod_authn_anon.so +#LoadModule authn_dbd_module modules/mod_authn_dbd.so +#LoadModule authn_socache_module modules/mod_authn_socache.so +LoadModule authn_core_module modules/mod_authn_core.so +LoadModule authz_host_module modules/mod_authz_host.so +LoadModule authz_groupfile_module modules/mod_authz_groupfile.so +LoadModule authz_user_module modules/mod_authz_user.so +#LoadModule authz_dbm_module modules/mod_authz_dbm.so +#LoadModule authz_owner_module modules/mod_authz_owner.so +#LoadModule authz_dbd_module modules/mod_authz_dbd.so +LoadModule authz_core_module modules/mod_authz_core.so +LoadModule access_compat_module modules/mod_access_compat.so +LoadModule auth_basic_module modules/mod_auth_basic.so +#LoadModule auth_form_module modules/mod_auth_form.so +#LoadModule auth_digest_module modules/mod_auth_digest.so +#LoadModule allowmethods_module modules/mod_allowmethods.so +#LoadModule file_cache_module modules/mod_file_cache.so +#LoadModule cache_module modules/mod_cache.so +#LoadModule cache_disk_module modules/mod_cache_disk.so +#LoadModule cache_socache_module modules/mod_cache_socache.so +#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so +#LoadModule socache_dbm_module modules/mod_socache_dbm.so +#LoadModule socache_memcache_module modules/mod_socache_memcache.so +#LoadModule macro_module modules/mod_macro.so +#LoadModule dbd_module modules/mod_dbd.so +#LoadModule dumpio_module modules/mod_dumpio.so +#LoadModule buffer_module modules/mod_buffer.so +#LoadModule ratelimit_module modules/mod_ratelimit.so +LoadModule reqtimeout_module modules/mod_reqtimeout.so +#LoadModule ext_filter_module modules/mod_ext_filter.so +#LoadModule request_module modules/mod_request.so +#LoadModule include_module modules/mod_include.so +LoadModule filter_module modules/mod_filter.so +#LoadModule substitute_module modules/mod_substitute.so +#LoadModule sed_module modules/mod_sed.so +LoadModule deflate_module modules/mod_deflate.so +LoadModule mime_module modules/mod_mime.so +LoadModule log_config_module modules/mod_log_config.so +#LoadModule log_debug_module modules/mod_log_debug.so +#LoadModule logio_module modules/mod_logio.so +LoadModule env_module modules/mod_env.so +#LoadModule mime_magic_module modules/mod_mime_magic.so +LoadModule expires_module modules/mod_expires.so +LoadModule headers_module modules/mod_headers.so +#LoadModule unique_id_module modules/mod_unique_id.so +LoadModule setenvif_module modules/mod_setenvif.so +LoadModule version_module modules/mod_version.so +LoadModule remoteip_module modules/mod_remoteip.so +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_connect_module modules/mod_proxy_connect.so +LoadModule proxy_ftp_module modules/mod_proxy_ftp.so +LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so +LoadModule proxy_scgi_module modules/mod_proxy_scgi.so +LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so +LoadModule proxy_ajp_module modules/mod_proxy_ajp.so +LoadModule proxy_balancer_module modules/mod_proxy_balancer.so +LoadModule proxy_express_module modules/mod_proxy_express.so +#LoadModule session_module modules/mod_session.so +#LoadModule session_cookie_module modules/mod_session_cookie.so +#LoadModule session_dbd_module modules/mod_session_dbd.so +LoadModule slotmem_shm_module modules/mod_slotmem_shm.so +LoadModule ssl_module modules/mod_ssl.so +LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so +LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so +LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so +LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so +#LoadModule mpm_event_module modules/mod_mpm_event.so +LoadModule mpm_prefork_module modules/mod_mpm_prefork.so +LoadModule unixd_module modules/mod_unixd.so +#LoadModule dav_module modules/mod_dav.so +LoadModule status_module modules/mod_status.so +LoadModule autoindex_module modules/mod_autoindex.so +#LoadModule info_module modules/mod_info.so +#LoadModule cgid_module modules/mod_cgid.so +#LoadModule dav_fs_module modules/mod_dav_fs.so +#LoadModule vhost_alias_module modules/mod_vhost_alias.so +#LoadModule negotiation_module modules/mod_negotiation.so +LoadModule dir_module modules/mod_dir.so +#LoadModule actions_module modules/mod_actions.so +#LoadModule speling_module modules/mod_speling.so +#LoadModule userdir_module modules/mod_userdir.so +LoadModule alias_module modules/mod_alias.so +LoadModule rewrite_module modules/mod_rewrite.so + + +# +# If you wish httpd to run as a different user or group, you must run +# httpd as root initially and it will switch. +# +# User/Group: The name (or #number) of the user/group to run httpd as. +# It is usually good practice to create a dedicated user and group for +# running httpd, as with most system services. +# +User www +Group www + + + +# 'Main' server configuration +# +# The directives in this section set up the values used by the 'main' +# server, which responds to any requests that aren't handled by a +# definition. These values also provide defaults for +# any containers you may define later in the file. +# +# All of these directives may appear inside containers, +# in which case these default settings will be overridden for the +# virtual host being defined. +# + +# +# ServerAdmin: Your address, where problems with the server should be +# e-mailed. This address appears on some server-generated pages, such +# as error documents. e.g. admin@your-domain.com +# +ServerAdmin you@example.com + +# +# ServerName gives the name and port that the server uses to identify itself. +# This can often be determined automatically, but we recommend you specify +# it explicitly to prevent problems during startup. +# +# If your host doesn't have a registered DNS name, enter its IP address here. +# +ServerName 0.0.0.0:80 + +# +# Deny access to the entirety of your server's filesystem. You must +# explicitly permit access to web content directories in other +# blocks below. +# + + AllowOverride All + Require all denied + + +# +# Note that from this point forward you must specifically allow +# particular features to be enabled - so if something's not working as +# you might expect, make sure that you have specifically enabled it +# below. +# + +# +# DocumentRoot: The directory out of which you will serve your +# documents. By default, all requests are taken from this directory, but +# symbolic links and aliases may be used to point to other locations. +# +DocumentRoot "/home/wwwroot/default" + + # + # Possible values for the Options directive are "None", "All", + # or any combination of: + # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews + # + # Note that "MultiViews" must be named *explicitly* --- "Options All" + # doesn't give it to you. + # + # The Options directive is both complicated and important. Please see + # http://httpd.apache.org/docs/2.4/mod/core.html#options + # for more information. + # + Options FollowSymLinks + + # + # AllowOverride controls what directives may be placed in .htaccess files. + # It can be "All", "None", or any combination of the keywords: + # AllowOverride FileInfo AuthConfig Limit + # + AllowOverride All + + # + # Controls who can get stuff from this server. + # + Require all granted + + +# +# DirectoryIndex: sets the file that Apache will serve if a directory +# is requested. +# + + DirectoryIndex index.html index.htm index.php + + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Require all denied + + +# +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog "/home/wwwlogs/error_log" + +# +# LogLevel: Control the number of messages logged to the error_log. +# Possible values include: debug, info, notice, warn, error, crit, +# alert, emerg. +# +LogLevel warn + + + # + # The following directives define some format nicknames for use with + # a CustomLog directive (see below). + # + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%h %l %u %t \"%r\" %>s %b" common + + + # You need to enable mod_logio.c to use %I and %O + LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio + + + # + # The location and format of the access logfile (Common Logfile Format). + # If you do not define any access logfiles within a + # container, they will be logged here. Contrariwise, if you *do* + # define per- access logfiles, transactions will be + # logged therein and *not* in this file. + # + CustomLog "/home/wwwlogs/access_log" common + + # + # If you prefer a logfile with access, agent, and referer information + # (Combined Logfile Format) you can use the following directive. + # + #CustomLog "logs/access_log" combined + + + + # + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client + # will make a new request for the document at its new location. + # Example: + # Redirect permanent /foo http://www.example.com/bar + + # + # Alias: Maps web paths into filesystem paths and is used to + # access content that does not live under the DocumentRoot. + # Example: + # Alias /webpath /full/filesystem/path + # + # If you include a trailing / on /webpath then the server will + # require it to be present in the URL. You will also likely + # need to provide a section to allow access to + # the filesystem path. + + # + # ScriptAlias: This controls which directories contain server scripts. + # ScriptAliases are essentially the same as Aliases, except that + # documents in the target directory are treated as applications and + # run by the server when requested rather than as documents sent to the + # client. The same rules about trailing "/" apply to ScriptAlias + # directives as to Alias. + # + ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" + + + + + # + # ScriptSock: On threaded servers, designate the path to the UNIX + # socket used to communicate with the CGI daemon of mod_cgid. + # + #Scriptsock cgisock + + +# +# "/usr/local/apache/cgi-bin" should be changed to whatever your ScriptAliased +# CGI directory exists, if you have that configured. +# + + AllowOverride All + Options None + Require all granted + + + + # + # TypesConfig points to the file containing the list of mappings from + # filename extension to MIME-type. + # + TypesConfig conf/mime.types + + # + # AddType allows you to add to or override the MIME configuration + # file specified in TypesConfig for specific file types. + # + #AddType application/x-gzip .tgz + # + # AddEncoding allows you to have certain browsers uncompress + # information on the fly. Note: Not all browsers support this. + # + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + # + # If the AddEncoding directives above are commented-out, then you + # probably should define those extensions to indicate media types: + # + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + AddType application/x-httpd-php .php + AddType application/x-httpd-php-source .phps + + # + # AddHandler allows you to map certain file extensions to "handlers": + # actions unrelated to filetype. These can be either built into the server + # or added with the Action directive (see below) + # + # To use CGI scripts outside of ScriptAliased directories: + # (You will also need to add "ExecCGI" to the "Options" directive.) + # + #AddHandler cgi-script .cgi + + # For type maps (negotiated resources): + #AddHandler type-map var + + # + # Filters allow you to process content before it is sent to the client. + # + # To parse .shtml files for server-side includes (SSI): + # (You will also need to add "Includes" to the "Options" directive.) + # + #AddType text/html .shtml + #AddOutputFilter INCLUDES .shtml + + +# +# The mod_mime_magic module allows the server to use various hints from the +# contents of the file itself to determine its type. The MIMEMagicFile +# directive tells the module where the hint definitions are located. +# +#MIMEMagicFile conf/magic + +# +# Customizable error responses come in three flavors: +# 1) plain text 2) local redirects 3) external redirects +# +# Some examples: +#ErrorDocument 500 "The server made a boo boo." +#ErrorDocument 404 /missing.html +#ErrorDocument 404 "/cgi-bin/missing_handler.pl" +#ErrorDocument 402 http://www.example.com/subscription_info.html +# + +# +# MaxRanges: Maximum number of Ranges in a request before +# returning the entire resource, or one of the special +# values 'default', 'none' or 'unlimited'. +# Default setting is to accept 200 Ranges. +#MaxRanges unlimited + +# +# EnableMMAP and EnableSendfile: On systems that support it, +# memory-mapping or the sendfile syscall may be used to deliver +# files. This usually improves server performance, but must +# be turned off when serving from networked-mounted +# filesystems or if support for these functions is otherwise +# broken on your system. +# Defaults: EnableMMAP On, EnableSendfile Off +# +#EnableMMAP off +#EnableSendfile on +LoadModule php5_module modules/libphp5.so + +# Supplemental configuration +# +# The configuration files in the conf/extra/ directory can be +# included to add extra features or to modify the default configuration of +# the server, or you may simply copy their contents here and change as +# necessary. + +# Server-pool management (MPM specific) +Include conf/extra/httpd-mpm.conf + +# Multi-language error messages +#Include conf/extra/httpd-multilang-errordoc.conf + +# Fancy directory listings +#Include conf/extra/httpd-autoindex.conf + +# Language settings +#Include conf/extra/httpd-languages.conf + +# User home directories +#Include conf/extra/httpd-userdir.conf + +# Real-time info on requests and configuration +#Include conf/extra/httpd-info.conf + +# Virtual hosts +Include conf/extra/httpd-vhosts.conf + +# Local access to the Apache HTTP Server Manual +#Include conf/extra/httpd-manual.conf + +# Distributed authoring and versioning (WebDAV) +#Include conf/extra/httpd-dav.conf + +# Various default settings +Include conf/extra/httpd-default.conf + +# Configure mod_proxy_html to understand HTML4/XHTML1 + +Include conf/extra/proxy-html.conf + + +# Secure (SSL/TLS) connections +#Include conf/extra/httpd-ssl.conf +# +# Note: The following must must be present to support +# starting without SSL on platforms with no /dev/random equivalent +# but a statically compiled-in mod_ssl. +# + +SSLRandomSeed startup builtin +SSLRandomSeed connect builtin + +# +# uncomment out the below to deal with user agents that deliberately +# violate open standards by misusing DNT (DNT *must* be a specific +# end-user choice) +# +# +#BrowserMatch "MSIE 10.0;" bad_DNT +# +# +#RequestHeader unset DNT env=bad_DNT +# + +IncludeOptional conf/vhost/*.conf diff --git a/conf/httpd24-lnmpa.conf b/conf/httpd24-lnmpa.conf new file mode 100644 index 00000000..cb5705a1 --- /dev/null +++ b/conf/httpd24-lnmpa.conf @@ -0,0 +1,510 @@ +# +# This is the main Apache HTTP server configuration file. It contains the +# configuration directives that give the server its instructions. +# See for detailed information. +# In particular, see +# +# for a discussion of each configuration directive. +# +# Do NOT simply read the instructions in here without understanding +# what they do. They're here only as hints or reminders. If you are unsure +# consult the online docs. You have been warned. +# +# Configuration and logfile names: If the filenames you specify for many +# of the server's control files begin with "/" (or "drive:/" for Win32), the +# server will use that explicit path. If the filenames do *not* begin +# with "/", the value of ServerRoot is prepended -- so "logs/access_log" +# with ServerRoot set to "/usr/local/apache2" will be interpreted by the +# server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" +# will be interpreted as '/logs/access_log'. + +# +# ServerRoot: The top of the directory tree under which the server's +# configuration, error, and log files are kept. +# +# Do not add a slash at the end of the directory path. If you point +# ServerRoot at a non-local disk, be sure to specify a local disk on the +# Mutex directive, if file-based mutexes are used. If you wish to share the +# same ServerRoot for multiple httpd daemons, you will need to change at +# least PidFile. +# +ServerRoot "/usr/local/apache" + +# +# Mutex: Allows you to set the mutex mechanism and mutex file directory +# for individual mutexes, or change the global defaults +# +# Uncomment and change the directory if mutexes are file-based and the default +# mutex file directory is not on a local disk or is not appropriate for some +# other reason. +# +# Mutex default:logs + +# +# Listen: Allows you to bind Apache to specific IP addresses and/or +# ports, instead of the default. See also the +# directive. +# +# Change this to Listen on specific IP addresses as shown below to +# prevent Apache from glomming onto all bound IP addresses. +# +#Listen 12.34.56.78:80 +Listen 127.0.0.1:88 + +# +# Dynamic Shared Object (DSO) Support +# +# To be able to use the functionality of a module which was built as a DSO you +# have to place corresponding `LoadModule' lines at this location so the +# directives contained in it are actually available _before_ they are used. +# Statically compiled modules (those listed by `httpd -l') do not need +# to be loaded here. +# +# Example: +# LoadModule foo_module modules/mod_foo.so +# +LoadModule authn_file_module modules/mod_authn_file.so +#LoadModule authn_dbm_module modules/mod_authn_dbm.so +#LoadModule authn_anon_module modules/mod_authn_anon.so +#LoadModule authn_dbd_module modules/mod_authn_dbd.so +#LoadModule authn_socache_module modules/mod_authn_socache.so +LoadModule authn_core_module modules/mod_authn_core.so +LoadModule authz_host_module modules/mod_authz_host.so +LoadModule authz_groupfile_module modules/mod_authz_groupfile.so +LoadModule authz_user_module modules/mod_authz_user.so +#LoadModule authz_dbm_module modules/mod_authz_dbm.so +#LoadModule authz_owner_module modules/mod_authz_owner.so +#LoadModule authz_dbd_module modules/mod_authz_dbd.so +LoadModule authz_core_module modules/mod_authz_core.so +LoadModule access_compat_module modules/mod_access_compat.so +LoadModule auth_basic_module modules/mod_auth_basic.so +#LoadModule auth_form_module modules/mod_auth_form.so +#LoadModule auth_digest_module modules/mod_auth_digest.so +#LoadModule allowmethods_module modules/mod_allowmethods.so +#LoadModule file_cache_module modules/mod_file_cache.so +#LoadModule cache_module modules/mod_cache.so +#LoadModule cache_disk_module modules/mod_cache_disk.so +#LoadModule cache_socache_module modules/mod_cache_socache.so +#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so +#LoadModule socache_dbm_module modules/mod_socache_dbm.so +#LoadModule socache_memcache_module modules/mod_socache_memcache.so +#LoadModule macro_module modules/mod_macro.so +#LoadModule dbd_module modules/mod_dbd.so +#LoadModule dumpio_module modules/mod_dumpio.so +#LoadModule buffer_module modules/mod_buffer.so +#LoadModule ratelimit_module modules/mod_ratelimit.so +LoadModule reqtimeout_module modules/mod_reqtimeout.so +#LoadModule ext_filter_module modules/mod_ext_filter.so +#LoadModule request_module modules/mod_request.so +#LoadModule include_module modules/mod_include.so +LoadModule filter_module modules/mod_filter.so +#LoadModule substitute_module modules/mod_substitute.so +#LoadModule sed_module modules/mod_sed.so +LoadModule deflate_module modules/mod_deflate.so +LoadModule mime_module modules/mod_mime.so +LoadModule log_config_module modules/mod_log_config.so +#LoadModule log_debug_module modules/mod_log_debug.so +#LoadModule logio_module modules/mod_logio.so +LoadModule env_module modules/mod_env.so +#LoadModule mime_magic_module modules/mod_mime_magic.so +LoadModule expires_module modules/mod_expires.so +LoadModule headers_module modules/mod_headers.so +#LoadModule unique_id_module modules/mod_unique_id.so +LoadModule setenvif_module modules/mod_setenvif.so +LoadModule version_module modules/mod_version.so +LoadModule remoteip_module modules/mod_remoteip.so +LoadModule proxy_module modules/mod_proxy.so +LoadModule proxy_connect_module modules/mod_proxy_connect.so +LoadModule proxy_ftp_module modules/mod_proxy_ftp.so +LoadModule proxy_http_module modules/mod_proxy_http.so +LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so +LoadModule proxy_scgi_module modules/mod_proxy_scgi.so +LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so +LoadModule proxy_ajp_module modules/mod_proxy_ajp.so +LoadModule proxy_balancer_module modules/mod_proxy_balancer.so +LoadModule proxy_express_module modules/mod_proxy_express.so +#LoadModule session_module modules/mod_session.so +#LoadModule session_cookie_module modules/mod_session_cookie.so +#LoadModule session_dbd_module modules/mod_session_dbd.so +LoadModule slotmem_shm_module modules/mod_slotmem_shm.so +LoadModule ssl_module modules/mod_ssl.so +LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so +LoadModule lbmethod_bytraffic_module modules/mod_lbmethod_bytraffic.so +LoadModule lbmethod_bybusyness_module modules/mod_lbmethod_bybusyness.so +LoadModule lbmethod_heartbeat_module modules/mod_lbmethod_heartbeat.so +#LoadModule mpm_event_module modules/mod_mpm_event.so +LoadModule mpm_prefork_module modules/mod_mpm_prefork.so +LoadModule unixd_module modules/mod_unixd.so +#LoadModule dav_module modules/mod_dav.so +LoadModule status_module modules/mod_status.so +LoadModule autoindex_module modules/mod_autoindex.so +#LoadModule info_module modules/mod_info.so +#LoadModule cgid_module modules/mod_cgid.so +#LoadModule dav_fs_module modules/mod_dav_fs.so +#LoadModule vhost_alias_module modules/mod_vhost_alias.so +#LoadModule negotiation_module modules/mod_negotiation.so +LoadModule dir_module modules/mod_dir.so +#LoadModule actions_module modules/mod_actions.so +#LoadModule speling_module modules/mod_speling.so +#LoadModule userdir_module modules/mod_userdir.so +LoadModule alias_module modules/mod_alias.so +LoadModule rewrite_module modules/mod_rewrite.so + + +# +# If you wish httpd to run as a different user or group, you must run +# httpd as root initially and it will switch. +# +# User/Group: The name (or #number) of the user/group to run httpd as. +# It is usually good practice to create a dedicated user and group for +# running httpd, as with most system services. +# +User www +Group www + + + +# 'Main' server configuration +# +# The directives in this section set up the values used by the 'main' +# server, which responds to any requests that aren't handled by a +# definition. These values also provide defaults for +# any containers you may define later in the file. +# +# All of these directives may appear inside containers, +# in which case these default settings will be overridden for the +# virtual host being defined. +# + +# +# ServerAdmin: Your address, where problems with the server should be +# e-mailed. This address appears on some server-generated pages, such +# as error documents. e.g. admin@your-domain.com +# +ServerAdmin you@example.com + +# +# ServerName gives the name and port that the server uses to identify itself. +# This can often be determined automatically, but we recommend you specify +# it explicitly to prevent problems during startup. +# +# If your host doesn't have a registered DNS name, enter its IP address here. +# +ServerName 127.0.0.1:88 + +# +# Deny access to the entirety of your server's filesystem. You must +# explicitly permit access to web content directories in other +# blocks below. +# + + AllowOverride All + Require all denied + + +# +# Note that from this point forward you must specifically allow +# particular features to be enabled - so if something's not working as +# you might expect, make sure that you have specifically enabled it +# below. +# + +# +# DocumentRoot: The directory out of which you will serve your +# documents. By default, all requests are taken from this directory, but +# symbolic links and aliases may be used to point to other locations. +# +DocumentRoot "/home/wwwroot/default" + + # + # Possible values for the Options directive are "None", "All", + # or any combination of: + # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews + # + # Note that "MultiViews" must be named *explicitly* --- "Options All" + # doesn't give it to you. + # + # The Options directive is both complicated and important. Please see + # http://httpd.apache.org/docs/2.4/mod/core.html#options + # for more information. + # + Options FollowSymLinks + + # + # AllowOverride controls what directives may be placed in .htaccess files. + # It can be "All", "None", or any combination of the keywords: + # AllowOverride FileInfo AuthConfig Limit + # + AllowOverride All + + # + # Controls who can get stuff from this server. + # + Require all granted + + +# +# DirectoryIndex: sets the file that Apache will serve if a directory +# is requested. +# + + DirectoryIndex index.html index.htm index.php + + +# +# The following lines prevent .htaccess and .htpasswd files from being +# viewed by Web clients. +# + + Require all denied + + +# +# ErrorLog: The location of the error log file. +# If you do not specify an ErrorLog directive within a +# container, error messages relating to that virtual host will be +# logged here. If you *do* define an error logfile for a +# container, that host's errors will be logged there and not here. +# +ErrorLog "/home/wwwlogs/error_log" + +# +# LogLevel: Control the number of messages logged to the error_log. +# Possible values include: debug, info, notice, warn, error, crit, +# alert, emerg. +# +LogLevel warn + + + # + # The following directives define some format nicknames for use with + # a CustomLog directive (see below). + # + LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined + LogFormat "%a %l %u %t \"%r\" %>s %b" common + + + # You need to enable mod_logio.c to use %I and %O + LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio + + + # + # The location and format of the access logfile (Common Logfile Format). + # If you do not define any access logfiles within a + # container, they will be logged here. Contrariwise, if you *do* + # define per- access logfiles, transactions will be + # logged therein and *not* in this file. + # + CustomLog "/home/wwwlogs/access_log" common + + # + # If you prefer a logfile with access, agent, and referer information + # (Combined Logfile Format) you can use the following directive. + # + #CustomLog "logs/access_log" combined + + + + # + # Redirect: Allows you to tell clients about documents that used to + # exist in your server's namespace, but do not anymore. The client + # will make a new request for the document at its new location. + # Example: + # Redirect permanent /foo http://www.example.com/bar + + # + # Alias: Maps web paths into filesystem paths and is used to + # access content that does not live under the DocumentRoot. + # Example: + # Alias /webpath /full/filesystem/path + # + # If you include a trailing / on /webpath then the server will + # require it to be present in the URL. You will also likely + # need to provide a section to allow access to + # the filesystem path. + + # + # ScriptAlias: This controls which directories contain server scripts. + # ScriptAliases are essentially the same as Aliases, except that + # documents in the target directory are treated as applications and + # run by the server when requested rather than as documents sent to the + # client. The same rules about trailing "/" apply to ScriptAlias + # directives as to Alias. + # + ScriptAlias /cgi-bin/ "/usr/local/apache/cgi-bin/" + + + + + # + # ScriptSock: On threaded servers, designate the path to the UNIX + # socket used to communicate with the CGI daemon of mod_cgid. + # + #Scriptsock cgisock + + +# +# "/usr/local/apache/cgi-bin" should be changed to whatever your ScriptAliased +# CGI directory exists, if you have that configured. +# + + AllowOverride All + Options None + Require all granted + + + + # + # TypesConfig points to the file containing the list of mappings from + # filename extension to MIME-type. + # + TypesConfig conf/mime.types + + # + # AddType allows you to add to or override the MIME configuration + # file specified in TypesConfig for specific file types. + # + #AddType application/x-gzip .tgz + # + # AddEncoding allows you to have certain browsers uncompress + # information on the fly. Note: Not all browsers support this. + # + #AddEncoding x-compress .Z + #AddEncoding x-gzip .gz .tgz + # + # If the AddEncoding directives above are commented-out, then you + # probably should define those extensions to indicate media types: + # + AddType application/x-compress .Z + AddType application/x-gzip .gz .tgz + AddType application/x-httpd-php .php + AddType application/x-httpd-php-source .phps + + # + # AddHandler allows you to map certain file extensions to "handlers": + # actions unrelated to filetype. These can be either built into the server + # or added with the Action directive (see below) + # + # To use CGI scripts outside of ScriptAliased directories: + # (You will also need to add "ExecCGI" to the "Options" directive.) + # + #AddHandler cgi-script .cgi + + # For type maps (negotiated resources): + #AddHandler type-map var + + # + # Filters allow you to process content before it is sent to the client. + # + # To parse .shtml files for server-side includes (SSI): + # (You will also need to add "Includes" to the "Options" directive.) + # + #AddType text/html .shtml + #AddOutputFilter INCLUDES .shtml + + +# +# The mod_mime_magic module allows the server to use various hints from the +# contents of the file itself to determine its type. The MIMEMagicFile +# directive tells the module where the hint definitions are located. +# +#MIMEMagicFile conf/magic + +# +# Customizable error responses come in three flavors: +# 1) plain text 2) local redirects 3) external redirects +# +# Some examples: +#ErrorDocument 500 "The server made a boo boo." +#ErrorDocument 404 /missing.html +#ErrorDocument 404 "/cgi-bin/missing_handler.pl" +#ErrorDocument 402 http://www.example.com/subscription_info.html +# + +# +# MaxRanges: Maximum number of Ranges in a request before +# returning the entire resource, or one of the special +# values 'default', 'none' or 'unlimited'. +# Default setting is to accept 200 Ranges. +#MaxRanges unlimited + +# +# EnableMMAP and EnableSendfile: On systems that support it, +# memory-mapping or the sendfile syscall may be used to deliver +# files. This usually improves server performance, but must +# be turned off when serving from networked-mounted +# filesystems or if support for these functions is otherwise +# broken on your system. +# Defaults: EnableMMAP On, EnableSendfile Off +# +#EnableMMAP off +#EnableSendfile on +LoadModule php5_module modules/libphp5.so +Include conf/extra/mod_remoteip.conf + +# Supplemental configuration +# +# The configuration files in the conf/extra/ directory can be +# included to add extra features or to modify the default configuration of +# the server, or you may simply copy their contents here and change as +# necessary. + +# Server-pool management (MPM specific) +Include conf/extra/httpd-mpm.conf + +# Multi-language error messages +#Include conf/extra/httpd-multilang-errordoc.conf + +# Fancy directory listings +#Include conf/extra/httpd-autoindex.conf + +# Language settings +#Include conf/extra/httpd-languages.conf + +# User home directories +#Include conf/extra/httpd-userdir.conf + +# Real-time info on requests and configuration +#Include conf/extra/httpd-info.conf + +# Virtual hosts +Include conf/extra/httpd-vhosts.conf + +# Local access to the Apache HTTP Server Manual +#Include conf/extra/httpd-manual.conf + +# Distributed authoring and versioning (WebDAV) +#Include conf/extra/httpd-dav.conf + +# Various default settings +Include conf/extra/httpd-default.conf + +# Configure mod_proxy_html to understand HTML4/XHTML1 + +Include conf/extra/proxy-html.conf + + +# Secure (SSL/TLS) connections +#Include conf/extra/httpd-ssl.conf +# +# Note: The following must must be present to support +# starting without SSL on platforms with no /dev/random equivalent +# but a statically compiled-in mod_ssl. +# + +SSLRandomSeed startup builtin +SSLRandomSeed connect builtin + +# +# uncomment out the below to deal with user agents that deliberately +# violate open standards by misusing DNT (DNT *must* be a specific +# end-user choice) +# +# +#BrowserMatch "MSIE 10.0;" bad_DNT +# +# +#RequestHeader unset DNT env=bad_DNT +# + +IncludeOptional conf/vhost/*.conf diff --git a/conf/index.html b/conf/index.html index ced750a9..5145ce1b 100644 --- a/conf/index.html +++ b/conf/index.html @@ -14,28 +14,29 @@ } .links {color: #009900} #main { + margin-top: 50px; margin-right: auto; margin-left: auto; - width: 920px; + width: 80%; } -->
-
恭喜,LNMP一键安装包安装成功!
-
LNMP一键安装包
+
恭喜您,LNMP一键安装包安装成功!
+
LNMP一键安装包

-

LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RadHat、Debian/Ubuntu VPS(VDS)或独立主机安装LNMP(Nginx、MySQL、PHP、phpMyAdmin)生产环境的Shell程序。

+

LNMP一键安装包是一个用Linux Shell编写的可以为CentOS/RadHat、Debian/Ubuntu VPS(VDS)或独立主机安装LNMP(Nginx、MySQL/Mariadb、PHP)、LNMPA(Nginx、MySQL/Mariadb、PHP、Apache)、LAMP(Apache、MySQL/Mariadb、PHP)生产环境的Shell程序。

-

查看本地环境:探针 phpinfo phpMyAdmin(为了更安全,建议将phpmyadmin目录重命名为不容易猜到的目录!)

+

查看本地环境: 探针  phpinfo  phpMyAdmin(为了安全,建议将phpmyadmin目录重命名为不容易猜到的目录!)

-

更多LNMP一键安装包信息请访问: http://lnmp.org

-

LNMP一键安装包问题反馈请访问: http://bbs.vpser.net/forum-25-1.html

-

VPS相关教程: http://www.vpser.net/vps-howto/

-

美国VPS推荐: http://www.vpser.net/usa-vps/

+

更多LNMP一键安装包信息请访问: http://lnmp.org

+

LNMP一键安装包问题反馈请访问: http://bbs.vpser.net/forum-25-1.html

+

VPS相关教程: http://www.vpser.net/vps-howto/

+

美国VPS推荐: http://www.vpser.net/usa-vps/

- +
\ No newline at end of file diff --git a/conf/lamp b/conf/lamp new file mode 100644 index 00000000..1945d630 --- /dev/null +++ b/conf/lamp @@ -0,0 +1,510 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script!" + exit 1 +fi + +echo "+-------------------------------------------+" +echo "| Manager for LNMP, Written by Licess |" +echo "+-------------------------------------------+" +echo "| http://lnmp.org |" +echo "+-------------------------------------------+" + +arg1=$1 +arg2=$2 + +lamp_start() +{ + echo "Starting LAMP..." + /etc/init.d/httpd start + /etc/init.d/mysql start +} + +lamp_stop() +{ + echo "Stoping LAMP..." + /etc/init.d/httpd stop + /etc/init.d/mysql stop +} + +lamp_reload() +{ + echo "Reload LAMP..." + /etc/init.d/httpd reload + /etc/init.d/mysql reload +} + +lamp_kill() +{ + echo "Kill apache,mysql process..." + killall httpd + killall mysqld + echo "done." +} + +lamp_status() +{ + /etc/init.d/httpd status + /etc/init.d/mysql status +} + +Function_Vhost() +{ + case "$1" in + [aA][dD][dD]) + Add_VHost + ;; + [lL][iI][sS][tT]) + List_VHost + ;; + [dD][eE][lL]) + Del_VHost + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp vhost {add|list|del}" + exit 1 + ;; +esac +} + +Function_Mysql() +{ + case "$1" in + [aA][dD][dD]) + Add_Database_Menu + Add_Database + ;; + [lL][iI][sS][tT]) + List_Database + ;; + [dD][eE][lL]) + Del_Database + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp mysql {add|list|del}" + exit 1 + ;; +esac +} + +Function_Ftp() +{ + case "$1" in + [aA][dD][dD]) + Add_Ftp_Menu + Add_Ftp + ;; + [lL][iI][sS][tT]) + List_Ftp + ;; + [dD][eE][lL]) + Del_Ftp + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp ftp {add|list|del}" + exit 1 + ;; +esac +} + +Add_VHost() +{ + domain="" + read -p "Please enter domain(example: www.lnmp.org): " domain + if [ "${domain}" = "" ]; then + echo "No enter,domain name can't be empty." + exit 1 + fi + if [ ! -f "/usr/local/apache/conf/vhost/${domain}.conf" ]; then + echo "======================================" + echo " Your domain: ${domain}" + echo "======================================" + else + echo "===============================" + echo "${domain} is exist!" + echo "===============================" + fi + + read -p "Do you want to add more domain name? (y/n) " add_more_domainame + + if [ "${add_more_domainame}" == "y" ]; then + + read -p "Enter domain name(example: lnmp.org *.lnmp.org): " moredomain + echo "domain list: ${moredomain}" + moredomainame=" ${moredomain}" + fi + + vhostdir="/home/wwwroot/${domain}" + echo "Please enter the directory for the domain: $domain" + read -p "(Default directory: /home/wwwroot/${domain}):" vhostdir + if [ "${vhostdir}" = "" ]; then + vhostdir="/home/wwwroot/${domain}" + fi + echo "Virtual Host Directory: ${vhostdir}" + + echo "===========================" + echo "Allow access_log? (y/n)" + echo "===========================" + read access_log + + if [ "${access_log}" == "n" ]; then + al="access_log off;" + else + read -p "Enter access log name(Default access log file:${domain}.log): " al_name + if [ "${al_name}" = "" ]; then + al_name="${domain}" + fi + al="access_log /home/wwwlogs/${al_name}.log access;" + + echo "You access log filename: ${al_name}.log" + fi + + ServerAdmin="" + read -p "Please enter Administrator Email Address:" ServerAdmin + if [ "${ServerAdmin}" == "" ]; then + echo "Administrator Email Address will set to webmaster@example.com!" + ServerAdmin="webmaster@example.com" + else + echo "================================================" + echo "Server Administrator Email:${ServerAdmin}" + echo "================================================" + fi + + echo "======================================================" + echo "Create database and MySQL user with same name (y/n)" + echo "======================================================" + read create_database + + if [ "${create_database}" == "y" ]; then + Verify_MySQL_Password + Add_Database_Menu + fi + + + if [ -f /usr/local/pureftpd/sbin/pure-config.pl ]; then + echo "======================================================" + echo "Create ftp account (y/n)" + echo "======================================================" + read create_ftp + + if [ "${create_ftp}" == "y" ]; then + if [ "${create_database}" != "y" ]; then + Verify_MySQL_Password + fi + Add_Ftp_Menu + fi + fi + + echo "" + echo "Press any key to start create virtul host..." + OLDCONFIG=`stty -g` + stty -icanon -echo min 1 time 0 + dd count=1 2>/dev/null + stty ${OLDCONFIG} + + echo "Create Virtul Host directory......" + mkdir -p ${vhostdir} + echo "set permissions of Virtual Host directory......" + chmod -R 755 ${vhostdir} + chown -R www:www ${vhostdir} + + cat >/usr/local/apache/conf/vhost/${domain}.conf< +ServerAdmin webmaster@example.com +php_admin_value open_basedir "${vhostdir}:/tmp/:/var/tmp/:/proc/" +DocumentRoot "${vhostdir}" +ServerName ${domain} +ErrorLog "/home/wwwlogs/${al_name}-error_log" +CustomLog "/home/wwwlogs/${al_name}-access_log" common +
+eof + + if [ "${access_log}" == 'n' ]; then + sed -i 's/ErrorLog/#ErrorLog/g' /usr/local/apache/conf/vhost/${domain}.conf + sed -i 's/CustomLog/#CustomLog/g' /usr/local/apache/conf/vhost/${domain}.conf + fi + + if [ "${add_more_domainame}" == 'y' ]; then + sed -i "/ServerName/a\ + ServerAlias ${moredomainame}" /usr/local/apache/conf/vhost/${domain}.conf + fi + + echo "Test Apache configure file..." + /etc/init.d/httpd configtest + echo "Restart Apache..." + /etc/init.d/httpd restart + + if [ "${create_database}" == "y" ]; then + Add_Database + fi + + if [ "${create_ftp}" == "y" ]; then + Add_Ftp + fi + + echo "================================================" + echo "Virtualhost infomation:" + echo "Your domain: ${domain}" + echo "Home Directory: ${vhostdir}" + if [ "${access_log}" = "n" ]; then + echo "Enable log: no" + else + echo "Enable log: yes" + fi + if [ "${create_database}" = "y" ]; then + echo "Database username: ${database_name}" + echo "Database userpassword: ${mysql_password}" + echo "Database Name: ${database_name}" + else + echo "Create database: no" + fi + if [ "${create_ftp}" = "y" ]; then + echo "FTP account name: ${ftp_account_name}" + echo "FTP account password: ${ftp_account_password}" + else + echo "Create ftp account: no" + fi + echo "================================================" +} + +List_VHost() +{ + echo "Apache Virtualhost list:" + ls /usr/local/apache/conf/vhost/ | grep ".conf$" | sed 's/.conf//g' +} + +Del_VHost() +{ + echo "=======================================" + echo "Current Virtualhost:" + List_VHost + echo "=======================================" + domain="" + read -p "Please enter domain you want to delete: " domain + if [ "${domain}" = "" ]; then + echo "No enter,domain name can't be empty." + exit 1 + fi + if [ ! -f "/usr/local/apache/conf/vhost/${domain}.conf" ]; then + echo "==========================================" + echo "Domain: ${domain} was not exist!" + echo "==========================================" + exit 1 + else + rm -f /usr/local/apache/conf/vhost/${domain}.conf + echo "========================================================" + echo "Domain: ${domain} has been deleted." + echo "Website files will not be deleted for security reasons." + echo "You need to manually delete the website files." + echo "========================================================" + fi +} + +Check_DB() +{ + if [[ -s /usr/local/mariadb/bin/mysql && -s /usr/local/mariadb/bin/mysqld_safe && -s /etc/my.cnf ]]; then + MySQL_Bin="/usr/local/mariadb/bin/mysql" + else + MySQL_Bin="/usr/local/mysql/bin/mysql" + fi +} + +Verify_MySQL_Password() +{ + read -p "verify your current MySQL root password:" mysql_root_password + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "quit" + if [ $? -eq 0 ]; then + echo "MySQL root password correct." + else + echo "MySQL root password incorrect!Please check!" + Verify_MySQL_Password + fi + if [ "${mysql_root_password}" = "" ]; then + Verify_MySQL_Password + fi +} + +Enter_Database_Name() +{ + read -p "Enter database name: " database_name + if [ "${database_name}" = "" ]; then + echo "Database Name can't be empty!" + exit 1 + fi +} + +Add_Database_Menu() +{ + Enter_Database_Name + echo "Your will create a database and MySQL user with same name: ${database_name}" + read -p "Please enter password for mysql user ${database_name}: " mysql_password + echo "Your password: ${mysql_password} " +} + +Add_Database() +{ + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "CREATE USER '${database_name}'@'127.0.0.1' IDENTIFIED BY '${mysql_password}'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "CREATE USER '${database_name}'@'localhost' IDENTIFIED BY '${mysql_password}'" + [ $? -eq 0 ] && echo "User ${database_name} create Sucessfully." || echo "User ${database_name} already exists!" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "GRANT USAGE ON *.* TO '${database_name}'@'127.0.0.1' IDENTIFIED BY '${mysql_password}'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "GRANT USAGE ON *.* TO '${database_name}'@'localhost' IDENTIFIED BY '${mysql_password}'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "CREATE DATABASE ${database_name}" + [ $? -eq 0 ] && echo "Database: ${database_name} create Sucessfully." || echo "Database: ${database_name} already exists!" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "GRANT ALL PRIVILEGES ON ${database_name}.* TO '${database_name}'@'127.0.0.1';" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "GRANT ALL PRIVILEGES ON ${database_name}.* TO '${database_name}'@'localhost';" + [ $? -eq 0 ] && echo "GRANT ALL PRIVILEGES ON ${database_name} Sucessfully." || echo "GRANT ALL PRIVILEGES ON ${database_name} failed!" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "FLUSH PRIVILEGES" + [ $? -eq 0 ] && echo "FLUSH PRIVILEGES Sucessfully." || echo "FLUSH PRIVILEGES failed!" +} + +List_Database() +{ + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "SHOW DATABASES;" + [ $? -eq 0 ] && echo "List all databases Sucessfully." || echo "List all databases failed!" +} + +Del_Database() +{ + List_Database + Enter_Database_Name + if [[ "${database_name}" = "information_schema" || "${database_name}" = "mysql" || "${database_name}" = "performance_schema" ]]; then + echo "MySQL System Database can't be delete!" + exit 1 + fi + echo "Your will delete database and MySQL user with same name: ${database_name}" + echo "Sleep 10s,Press ctrl+c to cancel..." + sleep 10 + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "DROP USER '${database_name}'@'127.0.0.1'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "DROP USER '${database_name}'@'localhost'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "DROP DATABASE ${database_name}" + [ $? -eq 0 ] && echo "Database: ${database_name} deleted Sucessfully." || echo "Database: ${database_name} not exist!" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "FLUSH PRIVILEGES" + [ $? -eq 0 ] && echo "FLUSH PRIVILEGES Sucessfully." || echo "FLUSH PRIVILEGES failed!" +} + +Enter_Ftp_Name() +{ + read -p "Enter ftp account name: " ftp_account_name + if [ "${ftp_account_name}" = "" ]; then + echo "FTP account name can't be empty!" + exit 1 + fi +} + +Add_Ftp_Menu() +{ + Enter_Ftp_Name + read -p "Enter password for ftp account ${ftp_account_name}: " ftp_account_password + if [ "${ftp_account_password}" = "" ]; then + echo "FTP password can't be empty!" + exit 1 + fi + if [ "${vhostdir}" = "" ]; then + read -p "Enter directory for ftp account ${ftp_account_name}: " vhostdir + if [ "${vhostdir}" = "" ]; then + echo "Directory can't be empty!" + exit 1 + fi + fi +} + +Check_Pureftpd() +{ + if [ ! -f /usr/local/pureftpd/sbin/pure-config.pl ]; then + echo "Pureftpd was not installed!" + exit 1 + fi +} + +Add_Ftp() +{ + www_uid=`id -u www` + www_gid=`id -g www` + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "INSERT INTO ftpusers.users VALUES ('${ftp_account_name}', MD5('${ftp_account_password}'), ${www_uid}, ${www_gid}, '${vhostdir}', 0, 0, 0, 0, '*', '${domain}', '1', 0, 0)" + [ $? -eq 0 ] && echo "Created FTP User: ${ftp_account_name} Sucessfully." || echo "FTP User: ${ftp_account_name} already exists!" +} + +List_Ftp() +{ + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "SELECT User,Dir FROM ftpusers.users users ORDER BY User ASC" + [ $? -eq 0 ] && echo "List FTP User Sucessfully." || echo "Read database failed." +} + +Del_Ftp() +{ + List_Ftp + Enter_Ftp_Name + echo "Your will delete ftp user ${ftp_account_name}" + echo "Sleep 10s,Press ctrl+c to cancel..." + sleep 10 + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "DELETE FROM ftpusers.users WHERE User='${ftp_account_name}'" + [ $? -eq 0 ] && echo "FTP User: ${ftp_account_name} deleted Sucessfully." || echo "FTP User: ${ftp_account_name} not exists!" +} + +Check_DB + +case "${arg1}" in + start) + lamp_start + ;; + stop) + lamp_stop + ;; + restart) + lamp_stop + lamp_start + ;; + reload) + lamp_reload + ;; + kill) + lamp_kill + ;; + status) + lamp_status + ;; + mysql) + /etc/init.d/mysql ${arg2} + ;; + mariadb) + /etc/init.d/mariadb ${arg2} + ;; + pureftpd) + /etc/init.d/pureftpd ${arg2} + ;; + httpd) + /etc/init.d/httpd ${arg2} + ;; + vhost) + Function_Vhost ${arg2} + ;; + database) + Verify_MySQL_Password + Function_Mysql ${arg2} + ;; + ftp) + Check_Pureftpd + Verify_MySQL_Password + Function_Ftp ${arg2} + ;; + *) + echo "Usage: lnmp {start|stop|reload|restart|kill|status}" + echo "Usage: lnmp {nginx|mysql|mariadb|pureftpd|httpd} {start|stop|reload|restart|kill|status}" + echo "Usage: lnmp vhost {add|list|del}" + echo "Usage: lnmp database {add|list|del}" + echo "Usage: lnmp ftp {add|list|del}" +esac +exit \ No newline at end of file diff --git a/conf/lnmp b/conf/lnmp new file mode 100644 index 00000000..23c650a5 --- /dev/null +++ b/conf/lnmp @@ -0,0 +1,572 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script!" + exit 1 +fi + +echo "+-------------------------------------------+" +echo "| Manager for LNMP, Written by Licess |" +echo "+-------------------------------------------+" +echo "| http://lnmp.org |" +echo "+-------------------------------------------+" + +PHPFPMPIDFILE=/usr/local/php/var/run/php-fpm.pid + +arg1=$1 +arg2=$2 + +lnmp_start() +{ + echo "Starting LNMP..." + /etc/init.d/nginx start + /etc/init.d/mysql start + /etc/init.d/php-fpm start +} + +lnmp_stop() +{ + echo "Stoping LNMP..." + /etc/init.d/nginx stop + /etc/init.d/mysql stop + /etc/init.d/php-fpm stop +} + +lnmp_reload() +{ + echo "Reload LNMP..." + /etc/init.d/nginx reload + /etc/init.d/mysql reload + /etc/init.d/php-fpm reload +} + +lnmp_kill() +{ + echo "Kill nginx,php-fpm,mysql process..." + killall nginx + killall mysqld + killall php-fpm + killall php-cgi + echo "done." +} + +lnmp_status() +{ + /etc/init.d/nginx status + if [ -f $PHPFPMPIDFILE ]; then + echo "php-fpm is runing!" + else + echo "php-fpm is stop!" + fi + /etc/init.d/mysql status +} + +Function_Vhost() +{ + case "$1" in + [aA][dD][dD]) + Add_VHost + ;; + [lL][iI][sS][tT]) + List_VHost + ;; + [dD][eE][lL]) + Del_VHost + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp vhost {add|list|del}" + exit 1 + ;; +esac +} + +Function_Mysql() +{ + case "$1" in + [aA][dD][dD]) + Add_Database_Menu + Add_Database + ;; + [lL][iI][sS][tT]) + List_Database + ;; + [dD][eE][lL]) + Del_Database + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp mysql {add|list|del}" + exit 1 + ;; +esac +} + +Function_Ftp() +{ + case "$1" in + [aA][dD][dD]) + Add_Ftp_Menu + Add_Ftp + ;; + [lL][iI][sS][tT]) + List_Ftp + ;; + [dD][eE][lL]) + Del_Ftp + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp ftp {add|list|del}" + exit 1 + ;; +esac +} + +Add_VHost() +{ + domain="" + read -p "Please enter domain(example: www.lnmp.org): " domain + if [ "${domain}" = "" ]; then + echo "No enter,domain name can't be empty." + exit 1 + fi + if [ ! -f "/usr/local/nginx/conf/vhost/${domain}.conf" ]; then + echo "======================================" + echo " Your domain: ${domain}" + echo "======================================" + else + echo "===============================" + echo "${domain} is exist!" + echo "===============================" + fi + + read -p "Do you want to add more domain name? (y/n) " add_more_domainame + + if [ "${add_more_domainame}" == "y" ]; then + + read -p "Enter domain name(example: lnmp.org *.lnmp.org): " moredomain + echo "domain list: ${moredomain}" + moredomainame=" ${moredomain}" + fi + + vhostdir="/home/wwwroot/${domain}" + echo "Please enter the directory for the domain: $domain" + read -p "(Default directory: /home/wwwroot/${domain}): " vhostdir + if [ "${vhostdir}" = "" ]; then + vhostdir="/home/wwwroot/${domain}" + fi + echo "Virtual Host Directory: ${vhostdir}" + + echo "===========================" + echo "Allow Rewrite rule? (y/n)" + echo "===========================" + read allow_rewrite + + if [ "${allow_rewrite}" == "n" ]; then + rewrite="none" + else + rewrite="other" + echo "Please enter the rewrite of programme: " + echo "wordpress,discuz,typecho,sablog,dabr rewrite was exist." + read -p "(Default rewrite: other):" rewrite + if [ "${rewrite}" = "" ]; then + rewrite="other" + fi + fi + echo "===========================" + echo "You choose rewrite=${rewrite}" + echo "===========================" + + echo "===========================" + echo "Allow access_log? (y/n)" + echo "===========================" + read access_log + + if [ "${access_log}" == "n" ]; then + al="access_log off;" + else + read -p "Enter access log name(Default access log file:${domain}.log): " al_name + if [ "${al_name}" = "" ]; then + al_name="${domain}" + fi + al="access_log /home/wwwlogs/${al_name}.log access;" + + echo "You access log filename: ${al_name}.log" + fi + + echo "======================================================" + echo "Create database and MySQL user with same name (y/n)" + echo "======================================================" + read create_database + + if [ "${create_database}" == "y" ]; then + Verify_MySQL_Password + Add_Database_Menu + fi + + + if [ -f /usr/local/pureftpd/sbin/pure-config.pl ]; then + echo "======================================================" + echo "Create ftp account (y/n)" + echo "======================================================" + read create_ftp + + if [ "${create_ftp}" == "y" ]; then + if [ "${create_database}" != "y" ]; then + Verify_MySQL_Password + fi + Add_Ftp_Menu + fi + fi + + echo "" + echo "Press any key to start create virtul host..." + OLDCONFIG=`stty -g` + stty -icanon -echo min 1 time 0 + dd count=1 2>/dev/null + stty ${OLDCONFIG} + + echo "Create Virtul Host directory......" + mkdir -p ${vhostdir} + if [ "${access_log}" == "n" ]; then + touch /home/wwwlogs/${al_name}.log + fi + echo "set permissions of Virtual Host directory......" + chmod -R 755 ${vhostdir} + chown -R www:www ${vhostdir} + + if [ ! -f /usr/local/nginx/conf/${rewrite}.conf ]; then + echo "Create Virtul Host ReWrite file......" + touch /usr/local/nginx/conf/${rewrite}.conf + echo "Create rewirte file successful,You can add rewrite rule into /usr/local/nginx/conf/${rewrite}.conf." + else + echo "You select the exist rewrite rule:/usr/local/nginx/conf/${rewrite}.conf" + fi + + cat >/usr/local/nginx/conf/vhost/${domain}.conf<${vhostdir}/.user.ini<?_a+vA3b`E!)v*+jz;m~ z#Mis;^*?j>I3RAjSKlbv#0=zymYA%t2|t{ZSJb_3{nmog&g_fgJ$obb3v1gY_ckgr7f?)O`5Zx$4ILOhLW)*0Z?y?7`<>cZM|X4sY5O za(Pd9-Oj+`eFq!-BWrvQT-<+9c#;F}7}vqFp{9n+RX zY)@A&I<7HNZ9IC@<6#~9l`O6}65W%9>&>_9yK*|^qsLPT z6B*QrO!Y~D!Ta2$?=Kop<(o|vSWFkM{UF@@q0;_iwadpk)~81A&n>&Zh=XQ2V`uxa zNJPT?k68ErKYxDx`V|@)`rq;m=V8=;2mt2)C*l8005}z(!W+1V zgtA1Ox|#nyQAKwuvdpc-rS)=erp~&E*Z0;O*n)*V?ewB2?(fSr^=|O*zgm4ipRw5r zVCGJu{yKzwdDVX{^g%f@k+8^3Z0fALKHN8)dnLX<0lDg0>NZq2)aVyzrMEoI>-iNO zLy`-D88m{$EV0?s@uP50c&~Jz)Lr{BJwE!^vo{^=gxgnLRiON*kHRjbsm$Y5Tk|j@ zpjR+c%G$lkFd+`4x%r$r3da%(KsLK;$wL$kx46vsbMczMmaOTF*SFdZRq#nxYUA(Q zUgMze8`xY=XAp}8e6oc_BjN)x|65m`&K3l{9lloSBc9?`Zb=jGQJoV4izwAvFQWG(>Z+@tBy!aTMBqHyug%BL4+iC#&E)c}2hUvYH>o_Hc;OV*GG;ixTch%R zWJ|$OsUd^n|3_B`*@)N zilmQJb*toZW>%yB#?Xek^BIELvb8=Rwmc@(n_oq4yN)b9Z~A?a7m=Z4qI9aVQ}BWQ z+!l;+RlE!$nM<9wIQ^rp2UEv$sgRQ3rf#?4&#dVhpu@q?^oGt#v+F}n0~H7Cy~Vw*=m3 zUFl&ocmDyy`R&ps3mM~Fc(-Si+x2Ihs4u6)#3OMBr!IT5b}b{nqlM|~gwgMgtUg0? z(zdk;=+=_F5+#v4LbH>#Eak!^HOsJy1+tY=xRttPIRgVFR6fJxlNO$ODpc~~yHE}O z(&K<`gR_~d+Q&!x&8i$9{xeio`zWx-*E6efq5R2`_UZE6&KD_!0LS5tOHu0neB5fD zy~YVH^roJV@slQK4v3OX02J^M;XDS)0pl!y|IY}x1)E;778>b#sQ!|y9_czf_h68SJA;e?Nao~vJ? zffB&_16%Pg6%OZ>fyPF4Wf63GqSDh9 zTyJXDn*Mw1-WTvF&eW(1Nxg^Lq9wo>=8xcR2)@nC(<>OY1(`dUvKG6kPO9DqVL3KOtT`1su}32HIZEIrE# zyyZO^&J+NkJU)7PPo3IujIEySyQmI--&GOK_Qy>8q^i= zLCxdz!`6aVAZc}$lo+8C&#UHQ44JZ%`{?l=R*cuHhacfx)4H@%gqZbW zA-ZdQxAyst!B?cm88TlIW44+D)lOI}fr5s>t_~cTo{8011p%MAm&-_L!xvmM2xg z7XsG-YZ0`GPyutMKy6cYlEe0(CAZnht0lJr`|T2HZJ%KUTWN$3bxSo%b&^9bxN(wQ zPZ|At>}7TS!ecXH743F_3(R07P{--SU=gTp+>X|g${$3!Flh&v3G0qOtI@x?9v`v@ zvdq&3usT~?94)-ifl8E|u=h%opR=_70JsP_C#AmcID4t03cUUgAQB9+Y>)MNYXd`_jBJr_WRmEO(qJduzAQMT@{`xP9-)g@n%aQtRbo& zA>ZM}UuP4=3__I>pT~4;krImOu{*5YTyvs*k44WUCRFu!&TH*d55PqMSRNOP%f?yG zVIWP~CpKkDN@3!XK8h$`=*TRWVyBbzNkp08QU-rgzcDBe^N~beFfktGEj;^rn?raN zdIJ~JW~IYsLmVz-&VXQ>iR(1 znq$wIMDjg;oscjmpkmjcWGa9xM$$<)i)8n8mMd9Vq9Rx^RLm61+z^mZY*kq(D3)kFF2mJ0WtTrfe0w!kG@ zzu=Qii6e?*Y69Q~LMnVg_?AW#GmSrK;B!Uk*IuN18)tB|GjO_5r!NQPPwrPo;i3e% z^K|TKq5fex_Phvtgq=A?rxNWc@A=3VE@cKt9z(J;XMm9#XZv!|D}x~>0xycj1TsJi z6&`9PmBHS6#VT+Y`Igk_`PF$J||`b zQNtU>(y<&%#9&(Ulsp@3-HAitPR>wg1pg_Sf*Yh5r{|ct(uizuvmCWT>E192)7j^P zozV;?+DBkuvI~fLj|$;J9tt=Dh*>NJVnTts!lEWTV5mTERHnKxpcO)J69O)#(;o6k zgZxucCb1bQ6^qEO$3lK6NOCqYGMxN|Nhkpb9U|ggm5A6b!skfSeYFd)Bk4PXVn591 z??7iGC>)Qco29@kc0i5@uwVr?Yo2nAzW~Y z9JQXY!! z<-Q1fC$IcTr@Y~lUo*&0x$$=p@=GoW%K%s}tL6~WEB>ihQu2V5R4&CgryBW1luZ?u zRZqosXxHpLx!D?|Bp_Q-pN7 zuu!)`w-wkbheCGo+<4GZmC^>wFEKnc!-*|3)oWHDJj!g@R#IImZq z?S|$uU@sozPPdgL!7D_NfyjW;N_x#}e9b2hONpvil!?5^H2@kzZ0B#pT+xd_e+Z)3~*-LL`eT4TgD_wZDECGDB3R?a1D&r%`v4MPa zH%V^4Z1Nbf2JvY`f~J1pOSxj_Sg~ty`bb0b-ik{8XYXhco7P({c6 zGfzED$HKHWz^xWubA>QNnNZe_b19G^bxKG9-%%!j950nkGM+}ARU$MlxP^Jck_%Y~ zP?i-Zw=3Pn4SJ>sdiOv1bccA>aqT ztl+G95WC*Lg_DeRGH0KZmcufvIIUpw0#>|$jT2y>Y@$vvk|Yw!S-q?&9;HJ zdAI5FnY~Sv+Y-tLVcQ-S6|vug7h2N+(2KseFZqs7y5&$8gjZ12zFRB#~o@Df2Z|o{D z_z$amtZU1koi!DtGs+Ev8k@W87Q_wLu0u0e7lS9F=pNm8%7nDX+#b+)2`!PMHwmCr zYll0k@rMS_ST>(o+B@x|W??HKx~P%0TMo0hkO2>H5&;?kk5eVYiEcuN0>9Oo)S(~< zxzr{F{;skVKuDL64!<1n3Q0fWA=s`@D?Kr&Uz)!v>v^T*x%H=LgLgQdVnAmwv$#<0 zkO*Zjhc?PlEWUIFn$;J$E#o7LV#_dC>RTXefP)4VeW%SkWPys#;JTsrbv zb_jQjj=d7Ce@KAYo#uRWne|=or*&=iHl?uIgnh*EP&4kuI3EvPHaMa>Ml1ZIBjXXq zKI3J|)1SVdp0?`e)e{;O_N4elp6~M<_(bEXwd!abq@z$G+#8RN2;iT~Py-l>v(tM=fY^0M4asoX^ObYXx-p z+++8l9i6_B7a^Zc-$guV$KTLqfrFOP`t2V>r^B9(aT!5h?6k8J0{0D;{ZK=sfDZkj zk$}5I3Hd*oIO7fD`GCFvLt^YZw0J7PZYpWtR7%`b8d5fu(K(g%_tg1+rvxoD6bjh% EKj)r)nE(I) literal 0 HcmV?d00001 diff --git a/conf/lnmpa b/conf/lnmpa new file mode 100644 index 00000000..8beafc27 --- /dev/null +++ b/conf/lnmpa @@ -0,0 +1,570 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script!" + exit 1 +fi + +echo "+-------------------------------------------+" +echo "| Manager for LNMP, Written by Licess |" +echo "+-------------------------------------------+" +echo "| http://lnmp.org |" +echo "+-------------------------------------------+" + +arg1=$1 +arg2=$2 + +lnmpa_start() +{ + echo "Starting LNMPA..." + /etc/init.d/nginx start + /etc/init.d/mysql start + /etc/init.d/httpd start +} + +lnmpa_stop() +{ + echo "Stoping LNMPA..." + /etc/init.d/nginx stop + /etc/init.d/mysql stop + /etc/init.d/httpd stop +} + +lnmpa_reload() +{ + echo "Reload LNMPA..." + /etc/init.d/nginx reload + /etc/init.d/mysql reload + /etc/init.d/httpd reload +} + +lnmpa_kill() +{ + echo "Kill nginx,apache,mysql process..." + killall nginx + killall httpd + killall mysqld + echo "done." +} + +lnmpa_status() +{ + /etc/init.d/nginx status + /etc/init.d/mysql status + /etc/init.d/httpd status +} + +Function_Vhost() +{ + case "$1" in + [aA][dD][dD]) + Add_VHost + ;; + [lL][iI][sS][tT]) + List_VHost + ;; + [dD][eE][lL]) + Del_VHost + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp vhost {add|list|del}" + exit 1 + ;; +esac +} + +Function_Mysql() +{ + case "$1" in + [aA][dD][dD]) + Add_Database_Menu + Add_Database + ;; + [lL][iI][sS][tT]) + List_Database + ;; + [dD][eE][lL]) + Del_Database + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp mysql {add|list|del}" + exit 1 + ;; +esac +} + +Function_Ftp() +{ + case "$1" in + [aA][dD][dD]) + Add_Ftp_Menu + Add_Ftp + ;; + [lL][iI][sS][tT]) + List_Ftp + ;; + [dD][eE][lL]) + Del_Ftp + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: lnmp ftp {add|list|del}" + exit 1 + ;; +esac +} + +Add_VHost() +{ + domain="" + read -p "Please enter domain(example: www.lnmp.org): " domain + if [ "${domain}" = "" ]; then + echo "No enter,domain name can't be empty." + exit 1 + fi + if [ ! -f "/usr/local/nginx/conf/vhost/${domain}.conf" ] || [ ! -f "/usr/local/nginx/conf/vhost/${domain}.conf" ]; then + echo "======================================" + echo " Your domain: ${domain}" + echo "======================================" + else + echo "===============================" + echo "${domain} is exist!" + echo "===============================" + fi + + read -p "Do you want to add more domain name? (y/n) " add_more_domainame + + if [ "${add_more_domainame}" == "y" ]; then + + read -p "Enter domain name(example: lnmp.org *.lnmp.org): " moredomain + echo "domain list: ${moredomain}" + moredomainame=" ${moredomain}" + fi + + vhostdir="/home/wwwroot/${domain}" + echo "Please enter the directory for the domain: $domain" + read -p "(Default directory: /home/wwwroot/${domain}): " vhostdir + if [ "${vhostdir}" = "" ]; then + vhostdir="/home/wwwroot/${domain}" + fi + echo "Virtual Host Directory: ${vhostdir}" + + echo "===========================" + echo "Allow access_log? (y/n)" + echo "===========================" + read access_log + + if [ "${access_log}" == "n" ]; then + al="access_log off;" + else + read -p "Enter access log name(Default access log file:${domain}.log): " al_name + if [ "${al_name}" = "" ]; then + al_name="${domain}" + fi + al="access_log /home/wwwlogs/${al_name}.log access;" + + echo "You access log filename: ${al_name}.log" + fi + + ServerAdmin="" + read -p "Please enter Administrator Email Address: " ServerAdmin + if [ "${ServerAdmin}" == "" ]; then + echo "Administrator Email Address will set to webmaster@example.com!" + ServerAdmin="webmaster@example.com" + else + echo "================================================" + echo "Server Administrator Email:${ServerAdmin}" + echo "================================================" + fi + + echo "======================================================" + echo "Create database and MySQL user with same name (y/n)" + echo "======================================================" + read create_database + + if [ "${create_database}" == "y" ]; then + Verify_MySQL_Password + Add_Database_Menu + fi + + + if [ -f /usr/local/pureftpd/sbin/pure-config.pl ]; then + echo "======================================================" + echo "Create ftp account (y/n)" + echo "======================================================" + read create_ftp + + if [ "${create_ftp}" == "y" ]; then + if [ "${create_database}" != "y" ]; then + Verify_MySQL_Password + fi + Add_Ftp_Menu + fi + fi + + echo "" + echo "Press any key to start create virtul host..." + OLDCONFIG=`stty -g` + stty -icanon -echo min 1 time 0 + dd count=1 2>/dev/null + stty ${OLDCONFIG} + + echo "Create Virtul Host directory......" + mkdir -p ${vhostdir} + if [ "${access_log}" == "n" ]; then + touch /home/wwwlogs/${al_name}.log + fi + echo "set permissions of Virtual Host directory......" + chmod -R 755 ${vhostdir} + chown -R www:www ${vhostdir} + + cat >/usr/local/nginx/conf/vhost/${domain}.conf</usr/local/apache/conf/vhost/${domain}.conf< +ServerAdmin webmaster@example.com +php_admin_value open_basedir "${vhostdir}:/tmp/:/var/tmp/:/proc/" +DocumentRoot "${vhostdir}" +ServerName ${domain} +ErrorLog "/home/wwwlogs/${al_name}-error_log" +CustomLog "/home/wwwlogs/${al_name}-access_log" common +
+eof + + if [ "${access_log}" == 'n' ]; then + sed -i 's/ErrorLog/#ErrorLog/g' /usr/local/apache/conf/vhost/${domain}.conf + sed -i 's/CustomLog/#CustomLog/g' /usr/local/apache/conf/vhost/${domain}.conf + fi + + if [ "${add_more_domainame}" == 'y' ]; then + sed -i "/ServerName/a\ + ServerAlias ${moredomainame}" /usr/local/apache/conf/vhost/${domain}.conf + fi + + echo "Test Nginx configure file......" + /usr/local/nginx/sbin/nginx -t + echo "" + echo "Restart Nginx......" + /usr/local/nginx/sbin/nginx -s reload + echo "Test Apache configure file..." + /etc/init.d/httpd configtest + echo "Restart Apache..." + /etc/init.d/httpd restart + + if [ "${create_database}" == "y" ]; then + Add_Database + fi + + if [ "${create_ftp}" == "y" ]; then + Add_Ftp + fi + + echo "================================================" + echo "Virtualhost infomation:" + echo "Your domain: ${domain}" + echo "Home Directory: ${vhostdir}" + if [ "${access_log}" = "n" ]; then + echo "Enable log: no" + else + echo "Enable log: yes" + fi + if [ "${create_database}" = "y" ]; then + echo "Database username: ${database_name}" + echo "Database userpassword: ${mysql_password}" + echo "Database Name: ${database_name}" + else + echo "Create database: no" + fi + if [ "${create_ftp}" = "y" ]; then + echo "FTP account name: ${ftp_account_name}" + echo "FTP account password: ${ftp_account_password}" + else + echo "Create ftp account: no" + fi + echo "================================================" +} + +List_VHost() +{ + echo "Nginx Virtualhost list:" + ls /usr/local/nginx/conf/vhost/ | grep ".conf$" | sed 's/.conf//g' + echo "Apache Virtualhost list:" + ls /usr/local/apache/conf/vhost/ | grep ".conf$" | sed 's/.conf//g' +} + +Del_VHost() +{ + echo "=======================================" + echo "Current Virtualhost:" + List_VHost + echo "=======================================" + domain="" + read -p "Please enter domain you want to delete: " domain + if [ "${domain}" = "" ]; then + echo "No enter,domain name can't be empty." + exit 1 + fi + if [ ! -f "/usr/local/nginx/conf/vhost/${domain}.conf" ] || [ ! -f "/usr/local/apache/conf/vhost/${domain}.conf" ]; then + echo "==========================================" + echo "Domain: ${domain} was not exist!" + echo "==========================================" + exit 1 + else + rm -f /usr/local/nginx/conf/vhost/${domain}.conf + rm -f /usr/local/apache/conf/vhost/${domain}.conf + echo "========================================================" + echo "Domain: ${domain} has been deleted." + echo "Website files will not be deleted for security reasons." + echo "You need to manually delete the website files." + echo "========================================================" + fi +} + +Check_DB() +{ + if [[ -s /usr/local/mariadb/bin/mysql && -s /usr/local/mariadb/bin/mysqld_safe && -s /etc/my.cnf ]]; then + MySQL_Bin="/usr/local/mariadb/bin/mysql" + else + MySQL_Bin="/usr/local/mysql/bin/mysql" + fi +} + +Verify_MySQL_Password() +{ + read -p "verify your current MySQL root password: " mysql_root_password + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "quit" + if [ $? -eq 0 ]; then + echo "MySQL root password correct." + else + echo "MySQL root password incorrect!Please check!" + Verify_MySQL_Password + fi + if [ "${mysql_root_password}" = "" ]; then + Verify_MySQL_Password + fi +} + +Enter_Database_Name() +{ + read -p "Enter database name: " database_name + if [ "${database_name}" = "" ]; then + echo "Database Name can't be empty!" + exit 1 + fi +} + +Add_Database_Menu() +{ + Enter_Database_Name + echo "Your will create a database and MySQL user with same name: ${database_name}" + read -p "Please enter password for mysql user ${database_name}: " mysql_password + echo "Your password: ${mysql_password} " +} + +Add_Database() +{ + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "CREATE USER '${database_name}'@'127.0.0.1' IDENTIFIED BY '${mysql_password}'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "CREATE USER '${database_name}'@'localhost' IDENTIFIED BY '${mysql_password}'" + [ $? -eq 0 ] && echo "User ${database_name} create Sucessfully." || echo "User ${database_name} already exists!" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "GRANT USAGE ON *.* TO '${database_name}'@'127.0.0.1' IDENTIFIED BY '${mysql_password}'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "GRANT USAGE ON *.* TO '${database_name}'@'localhost' IDENTIFIED BY '${mysql_password}'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "CREATE DATABASE ${database_name}" + [ $? -eq 0 ] && echo "Database: ${database_name} create Sucessfully." || echo "Database: ${database_name} already exists!" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "GRANT ALL PRIVILEGES ON ${database_name}.* TO '${database_name}'@'127.0.0.1';" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "GRANT ALL PRIVILEGES ON ${database_name}.* TO '${database_name}'@'localhost';" + [ $? -eq 0 ] && echo "GRANT ALL PRIVILEGES ON ${database_name} Sucessfully." || echo "GRANT ALL PRIVILEGES ON ${database_name} failed!" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "FLUSH PRIVILEGES" + [ $? -eq 0 ] && echo "FLUSH PRIVILEGES Sucessfully." || echo "FLUSH PRIVILEGES failed!" +} + +List_Database() +{ + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "SHOW DATABASES;" + [ $? -eq 0 ] && echo "List all databases Sucessfully." || echo "List all databases failed!" +} + +Del_Database() +{ + List_Database + Enter_Database_Name + if [[ "${database_name}" = "information_schema" || "${database_name}" = "mysql" || "${database_name}" = "performance_schema" ]]; then + echo "MySQL System Database can't be delete!" + exit 1 + fi + echo "Your will delete database and MySQL user with same name: ${database_name}" + echo "Sleep 10s,Press ctrl+c to cancel..." + sleep 10 + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "DROP USER '${database_name}'@'127.0.0.1'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "DROP USER '${database_name}'@'localhost'" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "DROP DATABASE ${database_name}" + [ $? -eq 0 ] && echo "Database: ${database_name} deleted Sucessfully." || echo "Database: ${database_name} not exist!" + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "FLUSH PRIVILEGES" + [ $? -eq 0 ] && echo "FLUSH PRIVILEGES Sucessfully." || echo "FLUSH PRIVILEGES failed!" +} + +Enter_Ftp_Name() +{ + read -p "Enter ftp account name: " ftp_account_name + if [ "${ftp_account_name}" = "" ]; then + echo "FTP account name can't be empty!" + exit 1 + fi +} + +Add_Ftp_Menu() +{ + Enter_Ftp_Name + read -p "Enter password for ftp account ${ftp_account_name}: " ftp_account_password + if [ "${ftp_account_password}" = "" ]; then + echo "FTP password can't be empty!" + exit 1 + fi + if [ "${vhostdir}" = "" ]; then + read -p "Enter directory for ftp account ${ftp_account_name}: " vhostdir + if [ "${vhostdir}" = "" ]; then + echo "Directory can't be empty!" + exit 1 + fi + fi +} + +Check_Pureftpd() +{ + if [ ! -f /usr/local/pureftpd/sbin/pure-config.pl ]; then + echo "Pureftpd was not installed!" + exit 1 + fi +} + +Add_Ftp() +{ + www_uid=`id -u www` + www_gid=`id -g www` + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "INSERT INTO ftpusers.users VALUES ('${ftp_account_name}', MD5('${ftp_account_password}'), ${www_uid}, ${www_gid}, '${vhostdir}', 0, 0, 0, 0, '*', '${domain}', '1', 0, 0)" + [ $? -eq 0 ] && echo "Created FTP User: ${ftp_account_name} Sucessfully." || echo "FTP User: ${ftp_account_name} already exists!" +} + +List_Ftp() +{ + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "SELECT User,Dir FROM ftpusers.users users ORDER BY User ASC" + [ $? -eq 0 ] && echo "List FTP User Sucessfully." || echo "Read database failed." +} + +Del_Ftp() +{ + List_Ftp + Enter_Ftp_Name + echo "Your will delete ftp user ${ftp_account_name}" + echo "Sleep 10s,Press ctrl+c to cancel..." + sleep 10 + ${MySQL_Bin} -uroot -p${mysql_root_password} -e "DELETE FROM ftpusers.users WHERE User='${ftp_account_name}'" + [ $? -eq 0 ] && echo "FTP User: ${ftp_account_name} deleted Sucessfully." || echo "FTP User: ${ftp_account_name} not exists!" +} + +Check_DB + +case "${arg1}" in + start) + lnmpa_start + ;; + stop) + lnmpa_stop + ;; + restart) + lnmpa_stop + lnmpa_start + ;; + reload) + lnmpa_reload + ;; + kill) + lnmpa_kill + ;; + status) + lnmpa_status + ;; + nginx) + /etc/init.d/nginx ${arg2} + ;; + mysql) + /etc/init.d/mysql ${arg2} + ;; + mariadb) + /etc/init.d/mariadb ${arg2} + ;; + pureftpd) + /etc/init.d/pureftpd ${arg2} + ;; + httpd) + /etc/init.d/httpd ${arg2} + ;; + vhost) + Function_Vhost ${arg2} + ;; + database) + Verify_MySQL_Password + Function_Mysql ${arg2} + ;; + ftp) + Check_Pureftpd + Verify_MySQL_Password + Function_Ftp ${arg2} + ;; + *) + echo "Usage: lnmp {start|stop|reload|restart|kill|status}" + echo "Usage: lnmp {nginx|mysql|mariadb|pureftpd|httpd} {start|stop|reload|restart|kill|status}" + echo "Usage: lnmp vhost {add|list|del}" + echo "Usage: lnmp database {add|list|del}" + echo "Usage: lnmp ftp {add|list|del}" +esac +exit \ No newline at end of file diff --git a/conf/memcached.php b/conf/memcached1.php similarity index 72% rename from conf/memcached.php rename to conf/memcached1.php index 92ade878..222497e0 100644 --- a/conf/memcached.php +++ b/conf/memcached1.php @@ -1,22 +1,28 @@ "; //连接 $mem = new Memcache; $mem->connect("127.0.0.1", 11211) or die ("Could not connect"); //显示版本 $version = $mem->getVersion(); -echo "Memcached Server version: ".$version."
"; +echo "Memcached Server version: ".$version."
"; //保存数据 $mem->set('key1', 'This is first value', 0, 60); $val = $mem->get('key1'); -echo "Get key1 value: " . $val ."
"; +echo "Get key1 value: " . $val ."
"; //替换数据 $mem->replace('key1', 'This is replace value', 0, 60); $val = $mem->get('key1'); -echo "Get key1 value: " . $val . "
"; +echo "Get key1 value: " . $val . "
"; //保存数组 $arr = array('aaa', 'bbb', 'ccc', 'ddd'); @@ -24,19 +30,19 @@ $val2 = $mem->get('key2'); echo "Get key2 value: "; print_r($val2); -echo "
"; +echo "
"; //删除数据 $mem->delete('key1'); $val = $mem->get('key1'); -echo "Get key1 value: " . $val . "
"; +echo "Get key1 value: " . $val . "
"; //清除所有数据 $mem->flush(); $val2 = $mem->get('key2'); echo "Get key2 value: "; print_r($val2); -echo "
"; +echo "
"; //关闭连接 $mem->close(); diff --git a/conf/memcached2.php b/conf/memcached2.php new file mode 100644 index 00000000..d569e03f --- /dev/null +++ b/conf/memcached2.php @@ -0,0 +1,47 @@ +"; +//连接 +$mem = new Memcached(); +$mem->addServer("127.0.0.1", 11211) or die ("Could not connect"); + +//显示版本 +$version = current($mem->getVersion()); +echo "Memcached Server version: ".$version ."
";; + +//保存数据 +$mem->set('key1', 'This is first value', 60); +$val = $mem->get('key1'); +echo "Get key1 value: " . $val ."
"; + +//替换数据 +$mem->replace('key1', 'This is replace value', 60); +$val = $mem->get('key1'); +echo "Get key1 value: " . $val . "
"; + +//保存数组 +$arr = array('aaa', 'bbb', 'ccc', 'ddd'); +$mem->set('key2', $arr, 60); +$val2 = $mem->get('key2'); +echo "Get key2 value: "; +print_r($val2); +echo "
"; + +//删除数据 +$mem->delete('key1'); +$val = $mem->get('key1'); +echo "Get key1 value: " . $val . "
"; + +//清除所有数据 +$mem->flush(); +$val2 = $mem->get('key2'); +echo "Get key2 value: "; +print_r($val2); +echo "
"; +?> +Memcached Test tools for LNMP一键安装包 技术支持论坛 \ No newline at end of file diff --git a/conf/mod_remoteip.conf b/conf/mod_remoteip.conf new file mode 100644 index 00000000..c4be3f0b --- /dev/null +++ b/conf/mod_remoteip.conf @@ -0,0 +1,3 @@ +#LoadModule remoteip_module modules/mod_remoteip.so +RemoteIPHeader X-Forwarded-For +RemoteIPInternalProxy 127.0.0.1 \ No newline at end of file diff --git a/conf/mysql_sec_script.sql b/conf/mysql_sec_script.sql new file mode 100644 index 00000000..6b3ec659 --- /dev/null +++ b/conf/mysql_sec_script.sql @@ -0,0 +1,7 @@ +use mysql; +update user set password=password('${MysqlRootPWD}') where user='root'; +delete from user where not (user='root') ; +delete from user where user='root' and password=''; +drop database test; +DROP USER ''@'%'; +flush privileges; \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 6dbf6877..7037851a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -10,92 +10,91 @@ pid /usr/local/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events - { - use epoll; - worker_connections 51200; - multi_accept on; - } + { + use epoll; + worker_connections 51200; + multi_accept on; + } http - { - include mime.types; - default_type application/octet-stream; - - server_names_hash_bucket_size 128; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 50m; - - sendfile on; - tcp_nopush on; - - keepalive_timeout 60; - - tcp_nodelay on; - - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - fastcgi_buffer_size 64k; - fastcgi_buffers 4 64k; - fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 256k; - - gzip on; - gzip_min_length 1k; - gzip_buffers 4 16k; - gzip_http_version 1.0; - gzip_comp_level 2; - gzip_types text/plain application/x-javascript text/css application/xml; - gzip_vary on; - gzip_proxied expired no-cache no-store private auth; - gzip_disable "MSIE [1-6]\."; - - #limit_conn_zone $binary_remote_addr zone=perip:10m; - ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. - - server_tokens off; - #log format - log_format access '$remote_addr - $remote_user [$time_local] "$request" ' + { + include mime.types; + default_type application/octet-stream; + + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 50m; + + sendfile on; + tcp_nopush on; + + keepalive_timeout 60; + + tcp_nodelay on; + + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 256k; + + gzip on; + gzip_min_length 1k; + gzip_buffers 4 16k; + gzip_http_version 1.1; + gzip_comp_level 2; + gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss; + gzip_vary on; + gzip_proxied expired no-cache no-store private auth; + gzip_disable "MSIE [1-6]\."; + + #limit_conn_zone $binary_remote_addr zone=perip:10m; + ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. + + server_tokens off; + #log format + log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; + access_log off; server - { - listen 80 default; - #listen [::]:80 default ipv6only=on; - server_name www.lnmp.org; - index index.html index.htm index.php; - root /home/wwwroot/default; - - #error_page 404 /404.html; - location ~ [^/]\.php(/|$) - { - # comment try_files $uri =404; to enable pathinfo - try_files $uri =404; - fastcgi_pass unix:/tmp/php-cgi.sock; - fastcgi_index index.php; - include fastcgi.conf; - #include pathinfo.conf; - } - - location /nginx_status { - stub_status on; - access_log off; - } - - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ - { - expires 30d; - } - - location ~ .*\.(js|css)?$ - { - expires 12h; - } - - access_log /home/wwwlogs/access.log access; - } + { + listen 80 default_server; + #listen [::]:80 default_server ipv6only=on; + server_name www.lnmp.org; + index index.html index.htm index.php; + root /home/wwwroot/default; + + #error_page 404 /404.html; + include enable-php.conf; + + location /nginx_status + { + stub_status on; + access_log off; + } + + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ + { + expires 30d; + } + + location ~ .*\.(js|css)?$ + { + expires 12h; + } + + location ~ /\. + { + deny all; + } + + access_log /home/wwwlogs/access.log access; + } include vhost/*.conf; } diff --git a/conf/nginx_a.conf b/conf/nginx_a.conf index 2925bde7..67b342a8 100644 --- a/conf/nginx_a.conf +++ b/conf/nginx_a.conf @@ -10,96 +10,90 @@ pid /usr/local/nginx/logs/nginx.pid; worker_rlimit_nofile 51200; events - { - use epoll; - worker_connections 51200; - multi_accept on; - } + { + use epoll; + worker_connections 51200; + multi_accept on; + } http - { - include mime.types; - default_type application/octet-stream; - - server_names_hash_bucket_size 128; - client_header_buffer_size 32k; - large_client_header_buffers 4 32k; - client_max_body_size 50m; - - sendfile on; - tcp_nopush on; - - keepalive_timeout 60; - - tcp_nodelay on; - - fastcgi_connect_timeout 300; - fastcgi_send_timeout 300; - fastcgi_read_timeout 300; - fastcgi_buffer_size 64k; - fastcgi_buffers 4 64k; - fastcgi_busy_buffers_size 128k; - fastcgi_temp_file_write_size 256k; - - gzip on; - gzip_min_length 1k; - gzip_buffers 4 16k; - gzip_http_version 1.0; - gzip_comp_level 2; - gzip_types text/plain application/x-javascript text/css application/xml; - gzip_vary on; - gzip_proxied expired no-cache no-store private auth; - gzip_disable "MSIE [1-6]\."; - - #limit_conn_zone $binary_remote_addr zone=perip:10m; - ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. - - #log format - log_format access '$remote_addr - $remote_user [$time_local] "$request" ' + { + include mime.types; + default_type application/octet-stream; + + server_names_hash_bucket_size 128; + client_header_buffer_size 32k; + large_client_header_buffers 4 32k; + client_max_body_size 50m; + + sendfile on; + tcp_nopush on; + + keepalive_timeout 60; + + tcp_nodelay on; + + fastcgi_connect_timeout 300; + fastcgi_send_timeout 300; + fastcgi_read_timeout 300; + fastcgi_buffer_size 64k; + fastcgi_buffers 4 64k; + fastcgi_busy_buffers_size 128k; + fastcgi_temp_file_write_size 256k; + + gzip on; + gzip_min_length 1k; + gzip_buffers 4 16k; + gzip_http_version 1.1; + gzip_comp_level 2; + gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss; + gzip_vary on; + gzip_proxied expired no-cache no-store private auth; + gzip_disable "MSIE [1-6]\."; + + #limit_conn_zone $binary_remote_addr zone=perip:10m; + ##If enable limit_conn_zone,add "limit_conn perip 10;" to server section. + + server_tokens off; + #log format + log_format access '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for'; + access_log off; server - { - listen 80 default; - #listen [::]:80 default ipv6only=on; - server_name www.lnmp.org; - index index.html index.htm index.php; - root /home/wwwroot/default; - - location / { - try_files $uri @apache; - } - - location @apache { - internal; - proxy_pass http://127.0.0.1:88; - include proxy.conf; - } - - location ~ [^/]\.php(/|$) - { - proxy_pass http://127.0.0.1:88; - include proxy.conf; - } - - location /nginx_status { - stub_status on; - access_log off; - } - - location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ - { - expires 30d; - } - - location ~ .*\.(js|css)?$ - { - expires 12h; - } - - access_log /home/wwwlogs/access.log access; - } + { + listen 80 default_server; + #listen [::]:80 default_server ipv6only=on; + server_name www.lnmp.org; + index index.html index.htm index.php; + root /home/wwwroot/default; + + include proxy-pass-php.conf; + + location /nginx_status + { + stub_status on; + access_log off; + } + + location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ + { + expires 30d; + } + + location ~ .*\.(js|css)?$ + { + expires 12h; + } + + location ~ /\. + { + deny all; + } + + access_log /home/wwwlogs/access.log access; + } include vhost/*.conf; } diff --git a/conf/ocp.php b/conf/ocp.php new file mode 100644 index 00000000..0b871b34 --- /dev/null +++ b/conf/ocp.php @@ -0,0 +1,390 @@ +1 || php_sapi_name()=='cli' || empty($_SERVER['REMOTE_ADDR']) ) { die; } // weak block against indirect access + +$time=time(); +define('CACHEPREFIX',function_exists('opcache_reset')?'opcache_':(function_exists('accelerator_reset')?'accelerator_':'')); + +if ( !empty($_GET['RESET']) ) { + if ( function_exists(CACHEPREFIX.'reset') ) { call_user_func(CACHEPREFIX.'reset'); } + header( 'Location: '.str_replace('?'.$_SERVER['QUERY_STRING'],'',$_SERVER['REQUEST_URI']) ); + exit; +} + +if ( !empty($_GET['RECHECK']) ) { + if ( function_exists(CACHEPREFIX.'invalidate') ) { + $recheck=trim($_GET['RECHECK']); $files=call_user_func(CACHEPREFIX.'get_status'); + if (!empty($files['scripts'])) { + foreach ($files['scripts'] as $file=>$value) { + if ( $recheck==='1' || strpos($file,$recheck)===0 ) call_user_func(CACHEPREFIX.'invalidate',$file); + } + } + header( 'Location: '.str_replace('?'.$_SERVER['QUERY_STRING'],'',$_SERVER['REQUEST_URI']) ); + } else { echo 'Sorry, this feature requires Zend Opcache newer than April 8th 2013'; } + exit; +} + +?> + + + OCP - Opcache Control Panel + + + + + + + +
+ +

Opcache Control Panel

+ +
+ Details + Files + Reset + + Recheck + + Refresh +
+ +Opcache not detected?'; die; } + +if ( !empty($_GET['FILES']) ) { echo '

files cached

'; files_display(); echo '
'; exit; } + +if ( !(isset($_REQUEST['GRAPHS']) && !$_REQUEST['GRAPHS']) && CACHEPREFIX=='opcache_') { graphs_display(); if ( !empty($_REQUEST['GRAPHS']) ) { exit; } } + +ob_start(); phpinfo(8); $phpinfo = ob_get_contents(); ob_end_clean(); // some info is only available via phpinfo? sadly buffering capture has to be used +if ( !preg_match( '/module\_Zend (Optimizer\+|OPcache).+?(\]*\>.+?\<\/table\>).+?(\]*\>.+?\<\/table\>)/s', $phpinfo, $opcache) ) { } // todo + +if ( function_exists(CACHEPREFIX.'get_configuration') ) { echo '

general

'; $configuration=call_user_func(CACHEPREFIX.'get_configuration'); } + +$host=function_exists('gethostname')?@gethostname():@php_uname('n'); if (empty($host)) { $host=empty($_SERVER['SERVER_NAME'])?$_SERVER['HOST_NAME']:$_SERVER['SERVER_NAME']; } +$version=array('Host'=>$host); +$version['PHP Version']='PHP '.(defined('PHP_VERSION')?PHP_VERSION:'???').' '.(defined('PHP_SAPI')?PHP_SAPI:'').' '.(defined('PHP_OS')?' '.PHP_OS:''); +$version['Opcache Version']=empty($configuration['version']['version'])?'???':$configuration['version'][CACHEPREFIX.'product_name'].' '.$configuration['version']['version']; +print_table($version); + +if ( !empty($opcache[2]) ) { echo preg_replace('/\\[^>]+\<\/td\>\[0-9\,\. ]+\<\/td\>\<\/tr\>/','',$opcache[2]); } + +if ( function_exists(CACHEPREFIX.'get_status') && $status=call_user_func(CACHEPREFIX.'get_status') ) { + $uptime=array(); + if ( !empty($status[CACHEPREFIX.'statistics']['start_time']) ) { + $uptime['uptime']=time_since($time,$status[CACHEPREFIX.'statistics']['start_time'],1,''); + } + if ( !empty($status[CACHEPREFIX.'statistics']['last_restart_time']) ) { + $uptime['last_restart']=time_since($time,$status[CACHEPREFIX.'statistics']['last_restart_time']); + } + if (!empty($uptime)) {print_table($uptime);} + + if ( !empty($status['cache_full']) ) { $status['memory_usage']['cache_full']=$status['cache_full']; } + + echo '

memory

'; + print_table($status['memory_usage']); + unset($status[CACHEPREFIX.'statistics']['start_time'],$status[CACHEPREFIX.'statistics']['last_restart_time']); + echo '

statistics

'; + print_table($status[CACHEPREFIX.'statistics']); +} + +if ( empty($_GET['ALL']) ) { meta_display(); exit; } + +if ( !empty($configuration['blacklist']) ) { echo '

blacklist

'; print_table($configuration['blacklist']); } + +if ( !empty($opcache[3]) ) { echo '

runtime

'; echo $opcache[3]; } + +$name='zend opcache'; $functions=get_extension_funcs($name); +if (!$functions) { $name='zend optimizer+'; $functions=get_extension_funcs($name); } +if ($functions) { echo '

functions

'; print_table($functions); } else { $name=''; } + +$level=trim(CACHEPREFIX,'_').'.optimization_level'; +if (isset($configuration['directives'][$level])) { + echo '

optimization levels

'; + $levelset=strrev(base_convert($configuration['directives'][$level], 10, 2)); + $levels=array( + 1=>'Constants subexpressions elimination (CSE) true, false, null, etc.
Optimize series of ADD_STRING / ADD_CHAR
Convert CAST(IS_BOOL,x) into BOOL(x)
Convert INIT_FCALL_BY_NAME + DO_FCALL_BY_NAME into DO_FCALL', + 2=>'Convert constant operands to expected types
Convert conditional JMP with constant operands
Optimize static BRK and CONT', + 3=>'Convert $a = $a + expr into $a += expr
Convert $a++ into ++$a
Optimize series of JMP', + 4=>'PRINT and ECHO optimization (defunct)', + 5=>'Block Optimization - most expensive pass
Performs many different optimization patterns based on control flow graph (CFG)', + 9=>'Optimize register allocation (allows re-usage of temporary variables)', + 10=>'Remove NOPs' + ); + echo ''; + foreach ($levels as $pass=>$description) { + $disabled=substr($levelset,$pass-1,1)!=='1' || $pass==4 ? ' white':''; + echo ''; + } + echo '
PassDescription
'.$pass.''.$description.'
'; +} + +if ( isset($_GET['DUMP']) ) { + if ($name) { echo '

ini

'; print_table(ini_get_all($name,true)); } + foreach ($configuration as $key=>$value) { echo '

',$key,'

'; print_table($configuration[$key]); } + exit; +} + +meta_display(); + +echo ''; + +exit; + +function time_since($time,$original,$extended=0,$text='ago') { + $time = $time - $original; + $day = $extended? floor($time/86400) : round($time/86400,0); + $amount=0; $unit=''; + if ( $time < 86400) { + if ( $time < 60) { $amount=$time; $unit='second'; } + elseif ( $time < 3600) { $amount=floor($time/60); $unit='minute'; } + else { $amount=floor($time/3600); $unit='hour'; } + } + elseif ( $day < 14) { $amount=$day; $unit='day'; } + elseif ( $day < 56) { $amount=floor($day/7); $unit='week'; } + elseif ( $day < 672) { $amount=floor($day/30); $unit='month'; } + else { $amount=intval(2*($day/365))/2; $unit='year'; } + + if ( $amount!=1) {$unit.='s';} + if ($extended && $time>60) { $text=' and '.time_since($time,$time<86400?($time<3600?$amount*60:$amount*3600):$day*86400,0,'').$text; } + + return $amount.' '.$unit.' '.$text; +} + +function print_table($array,$headers=false) { + if ( empty($array) || !is_array($array) ) {return;} + echo ''; + if (!empty($headers)) { + if (!is_array($headers)) {$headers=array_keys(reset($array));} + echo ''; + foreach ($headers as $value) { echo ''; } + echo ''; + } + foreach ($array as $key=>$value) { + echo ''; + if ( !is_numeric($key) ) { + $key=ucwords(str_replace('_',' ',$key)); + echo ''; + if ( is_numeric($value) ) { + if ( $value>1048576) { $value=round($value/1048576,1).'M'; } + elseif ( is_float($value) ) { $value=round($value,1); } + } + } + if ( is_array($value) ) { + foreach ($value as $column) { + echo ''; + } + echo ''; + } + else { echo ''; } + } + echo '
',$value,'
',$key,'',$column,'
',$value,'
'; +} + +function files_display() { + $status=call_user_func(CACHEPREFIX.'get_status'); + if ( empty($status['scripts']) ) {return;} + if ( isset($_GET['DUMP']) ) { print_table($status['scripts']); exit;} + $time=time(); $sort=0; + $nogroup=preg_replace('/\&?GROUP\=[\-0-9]+/','',$_SERVER['REQUEST_URI']); + $nosort=preg_replace('/\&?SORT\=[\-0-9]+/','',$_SERVER['REQUEST_URI']); + $group=empty($_GET['GROUP'])?0:intval($_GET['GROUP']); if ( $group<0 || $group>9) { $group=1;} + $groupset=array_fill(0,9,''); $groupset[$group]=' class="b" '; + + echo '
+ ungroup | + 1 | + 2 | + 3 | + 4 | + 5 +
'; + + if ( !$group ) { $files =& $status['scripts']; } + else { + $files=array(); + foreach ($status['scripts'] as $data) { + if ( preg_match('@^[/]([^/]+[/]){'.$group.'}@',$data['full_path'],$path) ) { + if ( empty($files[$path[0]])) { $files[$path[0]]=array('full_path'=>'','files'=>0,'hits'=>0,'memory_consumption'=>0,'last_used_timestamp'=>'','timestamp'=>''); } + $files[$path[0]]['full_path']=$path[0]; + $files[$path[0]]['files']++; + $files[$path[0]]['memory_consumption']+=$data['memory_consumption']; + $files[$path[0]]['hits']+=$data['hits']; + if ( $data['last_used_timestamp']>$files[$path[0]]['last_used_timestamp']) {$files[$path[0]]['last_used_timestamp']=$data['last_used_timestamp'];} + if ( $data['timestamp']>$files[$path[0]]['timestamp']) {$files[$path[0]]['timestamp']=$data['timestamp'];} + } + } + } + + if ( !empty($_GET['SORT']) ) { + $keys=array( + 'full_path'=>SORT_STRING, + 'files'=>SORT_NUMERIC, + 'memory_consumption'=>SORT_NUMERIC, + 'hits'=>SORT_NUMERIC, + 'last_used_timestamp'=>SORT_NUMERIC, + 'timestamp'=>SORT_NUMERIC + ); + $titles=array('','path',$group?'files':'','size','hits','last used','created'); + $offsets=array_keys($keys); + $key=intval($_GET['SORT']); + $direction=$key>0?1:-1; + $key=abs($key)-1; + $key=isset($offsets[$key])&&!($key==1&&empty($group))?$offsets[$key]:reset($offsets); + $sort=array_search($key,$offsets)+1; + $sortflip=range(0,7); $sortflip[$sort]=-$direction*$sort; + if ( $keys[$key]==SORT_STRING) {$direction=-$direction; } + $arrow=array_fill(0,7,''); $arrow[$sort]=$direction>0?' ▼':' ▲'; + $direction=$direction>0?SORT_DESC:SORT_ASC; + $column=array(); foreach ($files as $data) { $column[]=$data[$key]; } + array_multisort($column, $keys[$key], $direction, $files); + } + + echo ' + '; + foreach ($titles as $column=>$title) { + if ($title) echo ''; + } + echo ' '; + foreach ($files as $data) { + echo ' + ', + ($group?'':''), + '', + '', + '', + ' + '; + } + echo '
',$title,$arrow[$column],'
x',$data['full_path'],''.number_format($data['files']).'',number_format(round($data['memory_consumption']/1024)),'K',number_format($data['hits']),'',time_since($time,$data['last_used_timestamp']),'',empty($data['timestamp'])?'':time_since($time,$data['timestamp']),'
'; +} + +function graphs_display() { + $graphs=array(); + $colors=array('green','brown','red'); + $primes=array(223, 463, 983, 1979, 3907, 7963, 16229, 32531, 65407, 130987); + $configuration=call_user_func(CACHEPREFIX.'get_configuration'); + $status=call_user_func(CACHEPREFIX.'get_status'); + + $graphs['memory']['total']=$configuration['directives']['opcache.memory_consumption']; + $graphs['memory']['free']=$status['memory_usage']['free_memory']; + $graphs['memory']['used']=$status['memory_usage']['used_memory']; + $graphs['memory']['wasted']=$status['memory_usage']['wasted_memory']; + + $graphs['keys']['total']=$status[CACHEPREFIX.'statistics']['max_cached_keys']; + foreach ($primes as $prime) { if ($prime>=$graphs['keys']['total']) { $graphs['keys']['total']=$prime; break;} } + $graphs['keys']['free']=$graphs['keys']['total']-$status[CACHEPREFIX.'statistics']['num_cached_keys']; + $graphs['keys']['scripts']=$status[CACHEPREFIX.'statistics']['num_cached_scripts']; + $graphs['keys']['wasted']=$status[CACHEPREFIX.'statistics']['num_cached_keys']-$status[CACHEPREFIX.'statistics']['num_cached_scripts']; + + $graphs['hits']['total']=0; + $graphs['hits']['hits']=$status[CACHEPREFIX.'statistics']['hits']; + $graphs['hits']['misses']=$status[CACHEPREFIX.'statistics']['misses']; + $graphs['hits']['blacklist']=$status[CACHEPREFIX.'statistics']['blacklist_misses']; + $graphs['hits']['total']=array_sum($graphs['hits']); + + $graphs['restarts']['total']=0; + $graphs['restarts']['manual']=$status[CACHEPREFIX.'statistics']['manual_restarts']; + $graphs['restarts']['keys']=$status[CACHEPREFIX.'statistics']['hash_restarts']; + $graphs['restarts']['memory']=$status[CACHEPREFIX.'statistics']['oom_restarts']; + $graphs['restarts']['total']=array_sum($graphs['restarts']); + + foreach ( $graphs as $caption=>$graph) { + echo '
',$caption,'
'; + foreach ($graph as $label=>$value) { + if ($label=='total') { $key=0; $total=$value; $totaldisplay=''; continue;} + $percent=$total?floor($value*100/$total):''; $percent=!$percent||$percent>99?'':$percent.'%'; + echo '',$totaldisplay,''; + $key++; $totaldisplay=''; + } + echo '
'.($total>999999?round($total/1024/1024).'M':($total>9999?round($total/1024).'K':$total)).'
', ($value>999999?round($value/1024/1024).'M':($value>9999?round($value/1024).'K':$value)),'',$percent,'',$label,'
',"\n"; + } +} + +function meta_display() { +?> + + /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start..." - char=`get_char` - -function InitInstall() -{ -cat /etc/issue -uname -a -MemTotal=`free -m | grep Mem | awk '{print $2}'` -echo -e "\n Memory is: ${MemTotal} MB " -apt-get update -apt-get remove -y apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd -killall apache2 -dpkg -l |grep mysql -dpkg -P libmysqlclient15off libmysqlclient15-dev mysql-common -dpkg -l |grep apache -dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common -dpkg -l |grep php -dpkg -P php5 php5-common php5-cgi php5-mysql php5-curl php5-gd -apt-get purge `dpkg -l | grep php| awk '{print $2}'` - -#set timezone -rm -rf /etc/localtime -ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - -apt-get install -y ntpdate -ntpdate -u pool.ntp.org -date - -#Disable SeLinux -if [ -s /etc/selinux/config ]; then -sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config -fi - -if [ -s /etc/ld.so.conf.d/libc6-xen.conf ]; then -sed -i 's/hwcap 1 nosegneg/hwcap 0 nosegneg/g' /etc/ld.so.conf.d/libc6-xen.conf -fi - -apt-get install -y apt-spy -cp /etc/apt/sources.list /etc/apt/sources.list.bak -apt-spy update -apt-spy -d stable -a $area -t 5 - -grep null /etc/apt/sources.list.d/apt-spy.list -if [ $? -eq 0 ]; then -cat >/etc/apt/sources.list.d/apt-spy.list<> /etc/ld.so.conf -fi - -if [ ! `grep -l '/usr/lib' '/etc/ld.so.conf'` ]; then - echo "/usr/lib" >> /etc/ld.so.conf -fi - -if [ -d "/usr/lib64" ] && [ ! `grep -l '/usr/lib64' '/etc/ld.so.conf'` ]; then - echo "/usr/lib64" >> /etc/ld.so.conf -fi - -if [ ! `grep -l '/usr/local/lib' '/etc/ld.so.conf'` ]; then - echo "/usr/local/lib" >> /etc/ld.so.conf -fi - -ldconfig - -cat >>/etc/security/limits.conf<> /etc/sysctl.conf -} - -function InstallMySQL51() -{ -echo "============================Install MySQL 5.1.73==================================" -cd $cur_dir -rm -f /etc/my.cnf -rm -f /etc/mysql/my.cnf -rm -rf /etc/mysql/ -apt-get remove -y mysql-server -apt-get remove -y mysql-common mysql-client - -groupadd mysql -useradd -s /sbin/nologin -g mysql mysql - -cd $cur_dir -tar zxf mysql-5.1.73.tar.gz -cd mysql-5.1.73/ -if [ $installinnodb = "y" ]; then -./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase -else -./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile -fi -make && make install -cd ../ - -chown -R mysql /usr/local/mysql/var -chgrp -R mysql /usr/local/mysql/. - -cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf -sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf -if [ $installinnodb = "y" ]; then -sed -i 's:#innodb:innodb:g' /etc/my.cnf -fi -/usr/local/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var -ln -s /usr/local/mysql/share/mysql /usr/share/ - -chown -R mysql /usr/local/mysql/var -chgrp -R mysql /usr/local/mysql/. -cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql -chmod 755 /etc/init.d/mysql - -cat > /etc/ld.so.conf.d/mysql.conf< /tmp/mysql_sec_script< /etc/ld.so.conf.d/mysql.conf< /tmp/mysql_sec_script< /etc/ld.so.conf.d/mariadb.conf< /tmp/mariadb_sec_script<>/usr/local/php/etc/php.ini<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf</home/wwwroot/default/phpinfo.php< -eof - -echo "======================= phpMyAdmin install ============================" -cd $cur_dir -if [ "$isinstallphp53" = "n" ]; then - tar zxf phpmyadmin-latest.tar.gz - mv phpMyAdmin-3.4.8-all-languages /home/wwwroot/default/phpmyadmin -else - tar zxf phpMyAdmin-lasest.tar.gz - mv phpMyAdmin-*-all-languages /home/wwwroot/default/phpmyadmin -fi -cp conf/config.inc.php /home/wwwroot/default/phpmyadmin/config.inc.php -sed -i 's/LNMPORG/LNMP.org'$RANDOM'VPSer.net/g' /home/wwwroot/default/phpmyadmin/config.inc.php -mkdir /home/wwwroot/default/phpmyadmin/upload/ -mkdir /home/wwwroot/default/phpmyadmin/save/ -chmod 755 -R /home/wwwroot/default/phpmyadmin/ -chown www:www -R /home/wwwroot/default/phpmyadmin/ -echo "==================== phpMyAdmin install completed ======================" - -echo "Copy PHP Prober..." -tar zxvf p.tar.gz -cp p.php /home/wwwroot/default/p.php - -cp conf/index.html /home/wwwroot/default/index.html -} - -function AddAndStartup() -{ -echo "============================add nginx and php-fpm on startup============================" -echo "Download new nginx init.d file......" -wget -c http://soft.vpser.net/lnmp/ext/init.d.nginx -cp init.d.nginx /etc/init.d/nginx -chmod +x /etc/init.d/nginx - -if [ "$isinstallmysql55" = "md" ]; then - update-rc.d -f mariadb defaults -else - update-rc.d -f mysql defaults -fi -update-rc.d -f nginx defaults -update-rc.d -f php-fpm defaults - -cd $cur_dir -cp vhost.sh /root/vhost.sh -chmod +x /root/vhost.sh - -if [ "$isinstallmysql55" = "md" ]; then - sed -i 's:/etc/init.d/mysql:/etc/init.d/mariadb:g' /root/lnmp -fi -echo "===========================add nginx and php-fpm on startup completed====================" -echo "Starting LNMP..." -if [ "$isinstallmysql55" = "md" ]; then - /etc/init.d/mariadb start -else - /etc/init.d/mysql start -fi -/etc/init.d/php-fpm start -/etc/init.d/nginx start - -#add iptables firewall rules -if [ -s /sbin/iptables ]; then -/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT -/sbin/iptables -I INPUT -p tcp --dport 3306 -j DROP -/sbin/iptables-save -fi -} - -function CheckInstall() -{ -echo "===================================== Check install ===================================" -clear -isnginx="" -ismysql="" -isphp="" -echo "Checking..." -if [ -s /usr/local/nginx/conf/nginx.conf ] && [ -s /usr/local/nginx/sbin/nginx ]; then - echo "Nginx: OK" - isnginx="ok" - else - echo "Error: /usr/local/nginx not found!!!Nginx install failed." -fi - -if [ "$isinstallmysql55" = "md" ]; then - if [ -s /usr/local/mariadb/bin/mysql ] && [ -s /usr/local/mariadb/bin/mysqld_safe ] && [ -s /etc/my.cnf ]; then - echo "MariaDB: OK" - ismysql="ok" - else - echo "Error: /usr/local/mariadb not found!!!MySQL install failed." - fi -else - if [ -s /usr/local/mysql/bin/mysql ] && [ -s /usr/local/mysql/bin/mysqld_safe ] && [ -s /etc/my.cnf ]; then - echo "MySQL: OK" - ismysql="ok" - else - echo "Error: /usr/local/mysql not found!!!MySQL install failed." - fi -fi - -if [ -s /usr/local/php/sbin/php-fpm ] && [ -s /usr/local/php/etc/php.ini ] && [ -s /usr/local/php/bin/php ]; then - echo "PHP: OK" - echo "PHP-FPM: OK" - isphp="ok" - else - echo "Error: /usr/local/php not found!!!PHP install failed." -fi -if [ "$isnginx" = "ok" ] && [ "$ismysql" = "ok" ] && [ "$isphp" = "ok" ]; then -echo "Install lnmp 1.1 completed! enjoy it." -echo "=========================================================================" -echo "LNMP V1.1 for Debian Linux Server, Written by Licess " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "lnmp status manage: /root/lnmp {start|stop|reload|restart|kill|status}" -echo "default mysql root password:$mysqlrootpwd" -echo "phpinfo : http://yourIP/phpinfo.php" -echo "phpMyAdmin : http://yourIP/phpmyadmin/" -echo "Prober : http://yourIP/p.php" -echo "Add VirtualHost : /root/vhost.sh" -echo "" -echo "The path of some dirs:" -echo "mysql dir: /usr/local/mysql" -echo "php dir: /usr/local/php" -echo "nginx dir: /usr/local/nginx" -echo "web dir : /home/wwwroot/default" -echo "" -echo "=========================================================================" -/root/lnmp status -netstat -ntl -else -echo "Sorry,Failed to install LNMP!" -echo "Please visit http://bbs.vpser.net/forum-25-1.html feedback errors and logs." -echo "You can download /root/lnmp-install.log from your server,and upload lnmp-install.log to LNMP Forum." -fi -} - -InitInstall 2>&1 | tee /root/lnmp-install.log -CheckAndDownloadFiles 2>&1 | tee -a /root/lnmp-install.log -InstallDependsAndOpt 2>&1 | tee -a /root/lnmp-install.log -if [ "$isinstallmysql55" = "n" ]; then - InstallMySQL51 2>&1 | tee -a /root/lnmp-install.log -elif [ "$isinstallmysql55" = "y" ]; then - InstallMySQL55 2>&1 | tee -a /root/lnmp-install.log -else - InstallMariaDB 2>&1 | tee -a /root/lnmp-install.log -fi -if [ "$isinstallphp53" = "n" ]; then - InstallPHP52 2>&1 | tee -a /root/lnmp-install.log -else - InstallPHP53 2>&1 | tee -a /root/lnmp-install.log -fi -InstallNginx 2>&1 | tee -a /root/lnmp-install.log -CreatPHPTools 2>&1 | tee -a /root/lnmp-install.log -AddAndStartup 2>&1 | tee -a /root/lnmp-install.log -CheckInstall 2>&1 | tee -a /root/lnmp-install.log \ No newline at end of file diff --git a/eaccelerator.sh b/eaccelerator.sh deleted file mode 100644 index a3d39365..00000000 --- a/eaccelerator.sh +++ /dev/null @@ -1,204 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=======================================================================" -echo "Install eAcesselerator for LNMP , Written by Licess " -echo "=======================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to install eAccelerator for lnmp " -echo "" -echo "For more information please visit http://www.lnmp.org " -echo "=======================================================================" -cur_dir=$(pwd) - - ver="old" - echo "Which version do you want to install:" - echo "Install eaccelerator 0.9.5.3 please type: old" - echo "Install eaccelerator 0.9.6.1 please type: new" - echo "Install eaccelerator 1.0-dev please type: dev" - read -p "Type old, new or dev (Default version old):" ver - if [ "$ver" = "" ]; then - ver="old" - fi - - if [ "$ver" = "old" ]; then - echo "You will install eaccelerator 0.9.5.3" - elif [ "$ver" = "new" ]; then - echo "You will install eaccelerator 0.9.6.1" - elif [ "$ver" = "dev" ]; then - echo "You will install eaccelerator 1.0-dev" - else - echo "Input error,please input old, new or dev !" - echo "Please Rerun $0" - exit 1 - fi - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "=========================== install eaccelerator ======================" - -if [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/eaccelerator.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/eaccelerator.so -fi - -cur_php_version=`/usr/local/php/bin/php -v` -if [[ "$cur_php_version" =~ "PHP 5.2." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so" -elif [[ "$cur_php_version" =~ "PHP 5.3." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/eaccelerator.so" -elif [[ "$cur_php_version" =~ "PHP 5.4." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/eaccelerator.so" -elif [[ "$cur_php_version" =~ "PHP 5.5." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/eaccelerator.so" -else - echo "Error: can't get php version!" - echo "Maybe your php was didn't install or php configuration file has errors.Please check." - sleep 3 - exit 1 -fi - -#Install eaccelerator 0.9.5.3 -function install_old_ea { -if [ -s eaccelerator-0.9.5.3 ]; then - rm -rf eaccelerator-0.9.5.3/ -fi - -if [[ "$cur_php_version" =~ "PHP 5.3." ]] || [[ "$cur_php_version" =~ "PHP 5.4." ]] || [[ "$cur_php_version" =~ "PHP 5.5." ]]; then - echo "PHP 5.3.* , PHP 5.4.* , PHP 5.5.* Can't install eaccelerator 0.9.5.3!" - echo "PHP 5.3.* please input new or dev !" - echo "PHP 5.4.* and 5.5.* please input dev !" - exit 1 -fi - -wget -c http://soft.vpser.net/web/eaccelerator/eaccelerator-0.9.5.3.tar.bz2 -tar jxvf eaccelerator-0.9.5.3.tar.bz2 -cd eaccelerator-0.9.5.3/ -/usr/local/php/bin/phpize -./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config --with-eaccelerator-shared-memory -make -make install -cd ../ -} - -#Install eaccelerator 0.9.6.1 -function install_new_ea { -if [ -s eaccelerator-0.9.6.1 ]; then -rm -rf eaccelerator-0.9.6.1/ -fi - -if [[ "$cur_php_version" =~ "PHP 5.4." ]] || [[ "$cur_php_version" =~ "PHP 5.5." ]]; then - echo "PHP 5.4.* Can't install eaccelerator 0.9.6.1!" - echo "PHP 5.4.* and 5.5.* please input dev !" - exit 1 -fi - -wget -c http://soft.vpser.net/web/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 -tar jxvf eaccelerator-0.9.6.1.tar.bz2 -cd eaccelerator-0.9.6.1/ -/usr/local/php/bin/phpize -./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config -make -make install -cd ../ -} - -#Install eaccelerator git master branch 42067ac -function install_dev_ea { -if [ -s eaccelerator-eaccelerator-42067ac ]; then -rm -rf eaccelerator-eaccelerator-42067ac/ -fi - -wget -c http://soft.vpser.net/web/eaccelerator/eaccelerator-eaccelerator-42067ac.tar.gz -tar zxvf eaccelerator-eaccelerator-42067ac.tar.gz -cd eaccelerator-eaccelerator-42067ac/ -/usr/local/php/bin/phpize -./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config -make -make install -cd ../ -} - -if [ "$ver" = "old" ]; then - install_old_ea -elif [ "$ver" = "new" ]; then - install_new_ea -else - install_dev_ea -fi - -mkdir -p /usr/local/eaccelerator_cache -rm -rf /usr/local/eaccelerator_cache/* -sed -ni '1,/;eaccelerator/p;/;ionCube/,$ p' /usr/local/php/etc/php.ini - -cat >ea.ini< /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "============================check files==================================" -if [ -s ImageMagick-6.8.8-9.tar.gz ]; then - echo "ImageMagick-6.8.8-9.tar.gz [found]" - else - echo "Error: ImageMagick-6.8.8-9.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/imagemagick/ImageMagick-6.8.8-9.tar.gz - if [ $? -eq 0 ]; then - echo "Download ImageMagick-6.8.8-9.tar.gz successfully!" - else - echo "WARNING!ImageMagick-6.8.8-9.tar.gz was not download!" - sleep 5 - exit 1 - fi -fi - -if [ -s imagick-3.1.2.tgz ]; then - echo "imagick-3.1.2.tgz [found]" - else - echo "Error: imagick-3.0.1.tgz not found!!!download now......" - wget -c http://soft.vpser.net/web/imagick/imagick-3.1.2.tgz - if [ $? -eq 0 ]; then - echo "Download imagick-3.1.2.tgz successfully!" - else - echo "WARNING!imagick-3.1.2.tgz was not download!" - sleep 5 - exit 1 - fi -fi -echo "========================Install ImageMagick==============================" -tar zxvf ImageMagick-6.8.8-9.tar.gz -cd ImageMagick-6.8.8-9/ -./configure --prefix=/usr/local/imagemagick -make && make install -cd ../ - -tar zxvf imagick-3.1.2.tgz -cd imagick-3.1.2/ -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config --with-imagick=/usr/local/imagemagick -make && make install -cd ../ - -sed -i '/the dl()/i\ -extension = "imagick.so"' /usr/local/php/etc/php.ini - -if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then -echo "Restarting Apache......" -/etc/init.d/httpd restart -else -echo "Restarting php-fpm......" -/etc/init.d/php-fpm restart -fi - -echo "=========================================================================" -echo "You have successfully install ImageMagick " -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" -fi \ No newline at end of file diff --git a/include/apache.sh b/include/apache.sh new file mode 100644 index 00000000..6ff01876 --- /dev/null +++ b/include/apache.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +Install_Apache_22() +{ + Echo_Blue "[+] Installing ${Apache_Version}..." + if [ "${Stack}" = "lamp" ]; then + groupadd www + useradd -s /sbin/nologin -g www www + mkdir -p /home/wwwroot/default + chmod +w /home/wwwroot/default + mkdir -p /home/wwwlogs + chmod 777 /home/wwwlogs + chown -R www:www /home/wwwroot/default + fi + Tar_Cd ${Apache_Version}.tar.gz ${Apache_Version} + ./configure --prefix=/usr/local/apache --enable-mods-shared=most --enable-headers --enable-mime-magic --enable-proxy --enable-so --enable-rewrite --with-ssl --enable-ssl --enable-deflate --enable-suexec --with-included-apr --with-mpm=prefork --with-expat=builtin + make && make install + + mv /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak + if [ "${Stack}" = "lamp" ]; then + \cp ${cur_dir}/conf/httpd22-lamp.conf /usr/local/apache/conf/httpd.conf + \cp ${cur_dir}/conf/httpd-vhosts-lamp.conf /usr/local/apache/conf/extra/httpd-vhosts.conf + elif [ "${Stack}" = "lnmpa" ]; then + \cp ${cur_dir}/conf/httpd22-lnmpa.conf /usr/local/apache/conf/httpd.conf + \cp ${cur_dir}/conf/httpd-vhosts-lnmpa.conf /usr/local/apache/conf/extra/httpd-vhosts.conf + fi + \cp ${cur_dir}/conf/httpd-default.conf /usr/local/apache/conf/extra/httpd-default.conf + \cp ${cur_dir}/conf/mod_remoteip.conf /usr/local/apache/conf/extra/mod_remoteip.conf + + sed -i 's/ServerAdmin you@example.com/ServerAdmin '${ServerAdmin}'/g' /usr/local/apache/conf/httpd.conf + sed -i 's/webmaster@example.com/'${ServerAdmin}'/g' /usr/local/apache/conf/extra/httpd-vhosts.conf + mkdir -p /usr/local/apache/conf/vhost + + if [ "${Stack}" = "lnmpa" ]; then + \cp ${cur_dir}/src/patch/mod_remoteip.c . + /usr/local/apache/bin/apxs -i -c -n mod_remoteip.so mod_remoteip.c + sed -i 's/#LoadModule/LoadModule/g' /usr/local/apache/conf/extra/mod_remoteip.conf + fi + + ln -sf /usr/local/lib/libltdl.so.3 /usr/lib/libltdl.so.3 + mkdir /usr/local/apache/conf/vhost + + \cp ${cur_dir}/init.d/init.d.httpd /etc/init.d/httpd + chmod +x /etc/init.d/httpd +} + +Install_Apache_24() +{ + Echo_Blue "[+] Installing ${Apache_Version}..." + if [ "${Stack}" = "lamp" ]; then + groupadd www + useradd -s /sbin/nologin -g www www + mkdir -p /home/wwwroot/default + chmod +w /home/wwwroot/default + mkdir -p /home/wwwlogs + chmod 777 /home/wwwlogs + chown -R www:www /home/wwwroot/default + fi + Tar_Cd ${Apache_Version}.tar.gz ${Apache_Version} + cd srclib + Download_Files ${Download_Mirror}/web/apache/${APR_Ver}.tar.gz ${APR_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/apache/${APR_Util_Ver}.tar.gz ${APR_Util_Ver}.tar.gz + tar zxf ${APR_Ver}.tar.gz + tar zxf ${APR_Util_Ver}.tar.gz + mv ${APR_Ver} apr + mv ${APR_Util_Ver} apr-util + cd .. + ./configure --prefix=/usr/local/apache --enable-mods-shared=most --enable-headers --enable-mime-magic --enable-proxy --enable-so --enable-rewrite --with-ssl --enable-ssl --enable-deflate --with-pcre --with-included-apr --with-apr-util --enable-mpms-shared=all --with-mpm=prefork --enable-remoteip + make && make install + + mv /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak + if [ "${Stack}" = "lamp" ]; then + \cp ${cur_dir}/conf/httpd24-lamp.conf /usr/local/apache/conf/httpd.conf + \cp ${cur_dir}/conf/httpd-vhosts-lamp.conf /usr/local/apache/conf/extra/httpd-vhosts.conf + elif [ "${Stack}" = "lnmpa" ]; then + \cp ${cur_dir}/conf/httpd24-lnmpa.conf /usr/local/apache/conf/httpd.conf + \cp ${cur_dir}/conf/httpd-vhosts-lnmpa.conf /usr/local/apache/conf/extra/httpd-vhosts.conf + fi + \cp ${cur_dir}/conf/httpd-default.conf /usr/local/apache/conf/extra/httpd-default.conf + \cp ${cur_dir}/conf/mod_remoteip.conf /usr/local/apache/conf/extra/mod_remoteip.conf + mkdir /usr/local/apache/conf/vhost + + \cp ${cur_dir}/init.d/init.d.httpd /etc/init.d/httpd + chmod +x /etc/init.d/httpd +} \ No newline at end of file diff --git a/include/eaccelerator.sh b/include/eaccelerator.sh new file mode 100644 index 00000000..59b7553f --- /dev/null +++ b/include/eaccelerator.sh @@ -0,0 +1,170 @@ +#!/bin/bash + +#Install eaccelerator 0.9.5.3 +Install_Old_eA() +{ + if [ -s eaccelerator-0.9.5.3 ]; then + rm -rf eaccelerator-0.9.5.3/ + fi + + if echo "${Cur_PHP_Version}" | grep -Eqi '^5.[345].';then + echo "PHP 5.3.* and higher version Can't install eaccelerator 0.9.5.3!" + echo "PHP 5.3.* please enter 2 or 3 !" + echo "PHP 5.4.* please enter 3 !" + exit 1 + fi + + Download_Files ${Download_Mirror}/web/eaccelerator/eaccelerator-0.9.5.3.tar.bz2 eaccelerator-0.9.5.3.tar.bz2 + tar jxvf eaccelerator-0.9.5.3.tar.bz2 + cd eaccelerator-0.9.5.3/ + /usr/local/php/bin/phpize + ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config --with-eaccelerator-shared-memory + make + make install + cd ../ +} + +#Install eaccelerator 0.9.6.1 +Install_New_eA() +{ + if [ -s eaccelerator-0.9.6.1 ]; then + rm -rf eaccelerator-0.9.6.1/ + fi + + if echo "${Cur_PHP_Version}" | grep -Eqi '^5.[456].';then + echo "PHP 5.4.* and higher version Can't install eaccelerator 0.9.6.1!" + exit 1 + fi + + Download_Files ${Download_Mirror}/web/eaccelerator/eaccelerator-0.9.6.1.tar.bz2 eaccelerator-0.9.6.1.tar.bz2 + tar jxvf eaccelerator-0.9.6.1.tar.bz2 + cd eaccelerator-0.9.6.1/ + /usr/local/php/bin/phpize + ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config + make + make install + cd ../ +} + +#Install eaccelerator git master branch 42067ac +Install_Dev_eA() +{ + if [ -s eaccelerator-eaccelerator-42067ac ]; then + rm -rf eaccelerator-eaccelerator-42067ac/ + fi + + if echo "${Cur_PHP_Version}" | grep -Eqi '^5.[56].';then + echo "PHP 5.5.* and higher version do not support eaccelerator!" + exit 1 + fi + + Download_Files ${Download_Mirror}/web/eaccelerator/eaccelerator-eaccelerator-42067ac.tar.gz eaccelerator-eaccelerator-42067ac.tar.gz + tar zxvf eaccelerator-eaccelerator-42067ac.tar.gz + cd eaccelerator-eaccelerator-42067ac/ + /usr/local/php/bin/phpize + ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config + make + make install + cd ../ +} + +Install_eAccelerator() +{ + ver="3" + echo "Which version do you want to install:" + echo "Install eaccelerator 0.9.5.3 please enter: 1" + echo "Install eaccelerator 0.9.6.1 please enter: 2" + echo "Install eaccelerator 1.0-dev please enter: 3" + read -p "Enter 1, 2 or 3 (Default version 3): " ver + if [ "${ver}" = "" ]; then + ver="3" + fi + + if [ "${ver}" = "1" ]; then + echo "You will install eaccelerator 0.9.5.3" + elif [ "${ver}" = "2" ]; then + echo "You will install eaccelerator 0.9.6.1" + elif [ "${ver}" = "3" ]; then + echo "You will install eaccelerator 1.0-dev" + else + echo "Input error,please input 1, 2 or 3 !" + echo "Please Rerun $0" + exit 1 + fi + + echo "====== Installing eAccelerator ======" + Press_Install + + Get_PHP_Ext_Dir + zend_ext="${zend_ext_dir}eaccelerator.so" + if [ -s "${zend_ext}" ]; then + rm -f "${zend_ext}" + fi + if echo "${Cur_PHP_Version}" | grep -vEqi '^5.[2345].';then + echo "Error: Current PHP Version can't install eAccelerator." + echo "Maybe php was didn't install or php configuration file has errors.Please check." + sleep 3 + exit 1 + fi + + cd ${cur_dir}/src + if [ "${ver}" = "1" ]; then + Install_Old_eA + elif [ "${ver}" = "2" ]; then + Install_New_eA + else + Install_Dev_eA + fi + + mkdir -p /usr/local/eaccelerator_cache + rm -rf /usr/local/eaccelerator_cache/* + sed -ni '1,/;eaccelerator/p;/;ionCube/,$ p' /usr/local/php/etc/php.ini + + cat >ea.ini< /etc/apt/sources.list< ${utopic_deadline}" + CodeName='utopic' + elif [ ${cur_time} -gt ${vivid_deadline} ]; then + echo "${cur_time} > ${vivid_deadline}" + CodeName='vivid' + elif [ ${cur_time} -gt ${precise_deadline} ]; then + echo "${cur_time} > ${precise_deadline}" + CodeName='precise' + fi +} + +CentOS_Dependent() +{ + cp /etc/yum.conf /etc/yum.conf.lnmp + sed -i 's:exclude=.*:exclude=:g' /etc/yum.conf + + Echo_Blue "[+] Yum installing dependent packages..." + for packages in make cmake gcc gcc-c++ gcc-g77 flex bison file libtool libtool-libs autoconf kernel-devel patch wget libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel libxml2 libxml2-devel zlib zlib-devel glib2 glib2-devel unzip tar bzip2 bzip2-devel libevent libevent-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel vim-minimal gettext gettext-devel ncurses-devel gmp-devel pspell-devel unzip libcap diffutils net-tools libc-client-devel psmisc libXpm-devel git-core c-ares-devel; + do yum -y install $packages; done + + mv -f /etc/yum.conf.lnmp /etc/yum.conf +} + +Deb_Dependent() +{ + Echo_Blue "[+] Apt-get installing dependent packages..." + apt-get update -y + apt-get autoremove -y + apt-get -fy install + export DEBIAN_FRONTEND=noninteractive + apt-get install -y build-essential gcc g++ make + for packages in build-essential gcc g++ make cmake autoconf automake re2c wget cron bzip2 libzip-dev libc6-dev file rcconf flex vim bison m4 gawk less cpp binutils diffutils unzip tar bzip2 libbz2-dev libncurses5 libncurses5-dev libtool libevent-dev openssl libssl-dev zlibc libsasl2-dev libltdl3-dev libltdl-dev zlib1g zlib1g-dev libbz2-1.0 libbz2-dev libglib2.0-0 libglib2.0-dev libpng3 libjpeg62 libjpeg62-dev libjpeg-dev libpng-dev libpng12-0 libpng12-dev curl libcurl3 libcurl3-gnutls libcurl4-gnutls-dev libcurl4-openssl-dev libpq-dev libpq5 gettext libjpeg-dev libpng12-dev libxml2-dev libcap-dev ca-certificates debian-keyring debian-archive-keyring libc-client2007e-dev psmisc patch git libc-ares-dev; + do apt-get install -y $packages --force-yes; done +} + +Check_Download() +{ + Echo_Blue "[+] Downloading files..." + cd ${cur_dir}/src + Download_Files ${Download_Mirror}/lib/autoconf/${Autoconf_Ver}.tar.gz ${Autoconf_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/libiconv/${Libiconv_Ver}.tar.gz ${Libiconv_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/libmcrypt/${LibMcrypt_Ver}.tar.gz ${LibMcrypt_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/mcrypt/${Mcypt_Ver}.tar.gz ${Mcypt_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/mhash/${Mash_Ver}.tar.gz ${Mash_Ver}.tar.gz + Download_Files ${Download_Mirror}/lib/freetype/${Freetype_Ver}.tar.gz ${Freetype_Ver}.tar.gz + Download_Files ${Download_Mirror}/lib/curl/${Curl_Ver}.tar.gz ${Curl_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/pcre/${Pcre_Ver}.tar.gz ${Pcre_Ver}.tar.gz + if [ "${SelectMalloc}" = "2" ]; then + Download_Files ${Download_Mirror}/lib/jemalloc/${Jemalloc_Ver}.tar.bz2 ${Jemalloc_Ver}.tar.bz2 + elif [ "${SelectMalloc}" = "3" ]; then + Download_Files ${Download_Mirror}/lib/tcmalloc/${TCMalloc_Ver}.tar.gz ${TCMalloc_Ver}.tar.gz + Download_Files ${Download_Mirror}/lib/libunwind/${Libunwind_Ver}.tar.gz ${Libunwind_Ver}.tar.gz + fi + Download_Files ${Download_Mirror}/web/nginx/${Nginx_Ver}.tar.gz ${Nginx_Ver}.tar.gz + Download_Files ${Download_Mirror}/datebase/mysql/${Mysql_Ver}.tar.gz ${Mysql_Ver}.tar.gz + Download_Files ${Download_Mirror}/datebase/mariadb/${Mariadb_Ver}.tar.gz ${Mariadb_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/php/${Php_Ver}.tar.gz ${Php_Ver}.tar.gz + if [ ${PHPSelect} = "1" ]; then + Download_Files ${Download_Mirror}/web/phpfpm/${Php_Ver}-fpm-0.5.14.diff.gz ${Php_Ver}-fpm-0.5.14.diff.gz + fi + Download_Files ${Download_Mirror}/datebase/phpmyadmin/${PhpMyAdmin_Ver}.tar.gz ${PhpMyAdmin_Ver}.tar.gz + Download_Files ${Download_Mirror}/prober/p.tar.gz p.tar.gz + if [ "${Stack}" != "lnmp" ]; then + Download_Files ${Download_Mirror}/web/apache/${Apache_Version}.tar.gz ${Apache_Version}.tar.gz + Download_Files ${Download_Mirror}/web/apache/${APR_Ver}.tar.gz ${APR_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/apache/${APR_Util_Ver}.tar.gz ${APR_Util_Ver}.tar.gz + Download_Files ${Download_Mirror}/web/apache/rpaf/${Mod_RPAF_Ver}.tar.gz ${Mod_RPAF_Ver}.tar.gz + fi +} + +Install_Autoconf() +{ + Echo_Blue "[+] Installing ${Autoconf_Ver}" + Tar_Cd ${Autoconf_Ver}.tar.gz ${Autoconf_Ver} + ./configure --prefix=/usr/local/autoconf-2.13 + make && make install +} + +Install_Libiconv() +{ + Echo_Blue "[+] Installing ${Libiconv_Ver}" + Tar_Cd ${Libiconv_Ver}.tar.gz ${Libiconv_Ver} + patch -p0 < ${cur_dir}/src/patch/libiconv-glibc-2.16.patch + ./configure --enable-static + make && make install +} + +Install_Libmcrypt() +{ + Echo_Blue "[+] Installing ${LibMcrypt_Ver}" + Tar_Cd ${LibMcrypt_Ver}.tar.gz ${LibMcrypt_Ver} + ./configure + make && make install + /sbin/ldconfig + cd libltdl/ + ./configure --enable-ltdl-install + make && make install + ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la + ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so + ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 + ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 + ldconfig +} + +Install_Mcrypt() +{ + Echo_Blue "[+] Installing ${Mcypt_Ver}" + Tar_Cd ${Mcypt_Ver}.tar.gz ${Mcypt_Ver} + ./configure + make && make install +} + +Install_Mhash() +{ + Echo_Blue "[+] Installing ${Mash_Ver}" + Tar_Cd ${Mash_Ver}.tar.gz ${Mash_Ver} + ./configure + make && make install + ln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.a + ln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.la + ln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.so + ln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2 + ln -s /usr/local/lib/libmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1 + ldconfig +} + +Install_Freetype() +{ + Echo_Blue "[+] Installing ${Freetype_Ver}" + Tar_Cd ${Freetype_Ver}.tar.gz ${Freetype_Ver} + ./configure --prefix=/usr/local/freetype + make && make install + + cat > /etc/ld.so.conf.d/freetype.conf<> /etc/ld.so.conf + fi + + if [ `grep -L '/usr/lib' '/etc/ld.so.conf'` ]; then + echo "/usr/lib" >> /etc/ld.so.conf + #echo "/usr/lib/openssl/engines" >> /etc/ld.so.conf + fi + + if [ -d "/usr/lib64" ] && [ `grep -L '/usr/lib64' '/etc/ld.so.conf'` ]; then + echo "/usr/lib64" >> /etc/ld.so.conf + #echo "/usr/lib64/openssl/engines" >> /etc/ld.so.conf + fi + + if [ `grep -L '/usr/local/lib' '/etc/ld.so.conf'` ]; then + echo "/usr/local/lib" >> /etc/ld.so.conf + fi + + ldconfig + + cat >>/etc/security/limits.conf<> /etc/sysctl.conf +} + +Deb_Lib_Opt() +{ + if [ "${Is_64bit}" = "y" ] ; then + ln -s /usr/lib/x86_64-linux-gnu/libpng* /usr/lib/ + ln -s /usr/lib/x86_64-linux-gnu/libjpeg* /usr/lib/ + else + ln -s /usr/lib/i386-linux-gnu/libpng* /usr/lib/ + ln -s /usr/lib/i386-linux-gnu/libjpeg* /usr/lib/ + ln -s /usr/include/i386-linux-gnu/asm /usr/include/asm + fi + + ulimit -v unlimited + + if [ `grep -L "/lib" '/etc/ld.so.conf'` ]; then + echo "/lib" >> /etc/ld.so.conf + fi + + if [ `grep -L '/usr/lib' '/etc/ld.so.conf'` ]; then + echo "/usr/lib" >> /etc/ld.so.conf + fi + + if [ -d "/usr/lib64" ] && [ `grep -L '/usr/lib64' '/etc/ld.so.conf'` ]; then + echo "/usr/lib64" >> /etc/ld.so.conf + fi + + if [ `grep -L '/usr/local/lib' '/etc/ld.so.conf'` ]; then + echo "/usr/local/lib" >> /etc/ld.so.conf + fi + + ldconfig + + cat >>/etc/security/limits.conf<> /etc/sysctl.conf +} diff --git a/include/ionCube.sh b/include/ionCube.sh new file mode 100644 index 00000000..cf0f0b3e --- /dev/null +++ b/include/ionCube.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +Install_ionCube() +{ + echo "====== Installing ionCube ======" + Press_Install + + Get_PHP_Ext_Dir + if echo "${Cur_PHP_Version}" | grep -Eqi '^5.2.'; then + zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.2.so" + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.3.'; then + zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.3.so" + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.4.'; then + zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.4.so" + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.5.'; then + zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.5.so" + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.6.'; then + zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.6.so" + fi + + if [ -s "${zend_ext}" ]; then + rm -f "${zend_ext}" + fi + + rm -rf /usr/local/ioncube + cd ${cur_dir}/src + rm -rf ioncube + rm -rf ioncube_loaders_lin_x8*.tar.gz + if grep -Eqi "xcache.so" /usr/local/php/etc/php.ini; then + if [ "${Is_64bit}" = "y" ] ; then + Download_Files ${Download_Mirror}/web/ioncube/4.7.5/ioncube_loaders_lin_x86-64.tar.gz ioncube_loaders_lin_x86-64.tar.gz + tar zxf ioncube_loaders_lin_x86-64.tar.gz + else + cd ${cur_dir}/src + Download_Files ${Download_Mirror}/web/ioncube/4.7.5/ioncube_loaders_lin_x86.tar.gz ioncube_loaders_lin_x86.tar.gz + tar zxf ioncube_loaders_lin_x86.tar.gz + fi + else + if [ "${Is_64bit}" = "y" ] ; then + Download_Files http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz ioncube_loaders_lin_x86-64.tar.gz + tar zxf ioncube_loaders_lin_x86-64.tar.gz + else + cd ${cur_dir}/src + Download_Files http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz ioncube_loaders_lin_x86.tar.gz + tar zxf ioncube_loaders_lin_x86.tar.gz + fi + fi + mv ioncube /usr/local/ + + sed -ni '1,/;ionCube/p;/\[Zend/,$ p' /usr/local/php/etc/php.ini + + echo "Writing ionCube Loader to configure files..." + cat >ionCube.ini</dev/null + stty ${OLDCONFIG} + . include/version.sh +} + +Press_Start() +{ + echo "" + echo "Press any key to start...or Press Ctrl+c to cancel" + OLDCONFIG=`stty -g` + stty -icanon -echo min 1 time 0 + dd count=1 2>/dev/null + stty ${OLDCONFIG} +} + +Install_LSB() +{ + if [ "$PM" = "yum" ]; then + yum -y install redhat-lsb + elif [ "$PM" = "apt" ]; then + apt-get update + apt-get install -y lsb-release + fi +} + +Get_Dist_Version() +{ + Install_LSB + eval ${DISTRO}_Version=`lsb_release -rs` + eval echo "${DISTRO} \${${DISTRO}_Version}" +} + +Get_Dist_Name() +{ + if grep -Eqi "CentOS" /etc/issue || grep -Eq "CentOS" /etc/*-release; then + DISTRO='CentOS' + PM='yum' + elif grep -Eqi "Red Hat Enterprise Linux Server" /etc/issue || grep -Eq "Red Hat Enterprise Linux Server" /etc/*-release; then + DISTRO='RHEL' + PM='yum' + elif grep -Eqi "Aliyun" /etc/issue || grep -Eq "Aliyun" /etc/*-release; then + DISTRO='Aliyun' + PM='yum' + elif grep -Eqi "Fedora" /etc/issue || grep -Eq "Fedora" /etc/*-release; then + DISTRO='Fedora' + PM='yum' + elif grep -Eqi "Debian" /etc/issue || grep -Eq "Debian" /etc/*-release; then + DISTRO='Debian' + PM='apt' + elif grep -Eqi "Ubuntu" /etc/issue || grep -Eq "Ubuntu" /etc/*-release; then + DISTRO='Ubuntu' + PM='apt' + elif grep -Eqi "Raspbian" /etc/issue || grep -Eq "Raspbian" /etc/*-release; then + DISTRO='Raspbian' + PM='apt' + else + DISTRO='unknow' + fi + Get_OS_Bit +} + +Get_RHEL_Version() +{ + Get_Dist_Name + if [ "${DISTRO}" = "RHEL" ]; then + if grep -Eqi "release 5." /etc/redhat-release; then + echo "Current Version: RHEL Ver 5" + RHEL_Ver='5' + elif grep -Eqi "release 6." /etc/redhat-release; then + echo "Current Version: RHEL Ver 6" + RHEL_Ver='6' + elif grep -Eqi "release 7." /etc/redhat-release; then + echo "Current Version: RHEL Ver 7" + RHEL_Ver='7' + fi + fi +} + +Get_OS_Bit() +{ + if [[ `getconf WORD_BIT` = '32' && `getconf LONG_BIT` = '64' ]] ; then + Is_64bit='y' + else + Is_64bit='n' + fi +} + +Get_ARM() +{ + if uname -m | grep -Eqi "arm"; then + Is_ARM='y' + fi +} + +Download_Files() +{ + local URL=$1 + local FileName=$2 + if [ -s "${FileName}" ]; then + echo "${FileName} [found]" + else + echo "Error: ${FileName} not found!!!download now..." + wget -c ${URL} + fi +} + +Tar_Cd() +{ + local FileName=$1 + local DirName=$2 + cd ${cur_dir}/src + [[ -d "${DirName}" ]] && rm -rf ${DirName} + echo "Uncompress ${FileName}..." + tar zxf ${FileName} + echo "cd ${DirName}..." + cd ${DirName} +} + +Print_Sys_Info() +{ + cat /etc/issue + cat /etc/*-release + uname -a + MemTotal=`free -m | grep Mem | awk '{print $2}'` + echo "Memory is: ${MemTotal} MB " + df -h +} + +StartUp() +{ + init_name=$1 + echo "Add ${init_name} service at system startup..." + if [ "$PM" = "yum" ]; then + chkconfig --add ${init_name} + chkconfig ${init_name} on + elif [ "$PM" = "apt" ]; then + update-rc.d -f ${init_name} defaults + fi +} + +Remove_StartUp() +{ + init_name=$1 + echo "Removing ${init_name} service at system startup..." + if [ "$PM" = "yum" ]; then + chkconfig ${init_name} off + chkconfig --del ${init_name} + elif [ "$PM" = "apt" ]; then + update-rc.d -f ${init_name} remove + fi +} + +Color_Text() +{ + echo -e " \e[0;$2m$1\e[0m" +} + +Echo_Red() +{ + echo $(Color_Text "$1" "31") +} + +Echo_Green() +{ + echo $(Color_Text "$1" "32") +} + +Echo_Yellow() +{ + echo $(Color_Text "$1" "33") +} + +Echo_Blue() +{ + echo $(Color_Text "$1" "34") +} + +Get_PHP_Ext_Dir() +{ + Cur_PHP_Version=`/usr/local/php/bin/php -r 'echo PHP_VERSION;'` + if echo "${Cur_PHP_Version}" | grep -Eqi '^5.2.'; then + zend_ext_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/" + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.3.'; then + zend_ext_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/" + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.4.'; then + zend_ext_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/" + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.5.'; then + zend_ext_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/" + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.6.'; then + zend_ext_dir="/usr/local/php/lib/php/extensions/no-debug-non-zts-20131226/" + fi +} + +Check_Stack() +{ + if [[ -s /usr/local/php/bin/php-cgi || -s /usr/local/php/sbin/php-fpm ]] && [[ -s /usr/local/php/etc/php-fpm.conf && -s /etc/init.d/php-fpm && -s /usr/local/nginx/sbin/nginx ]]; then + Get_Stack="lnmp" + elif [[ -s /usr/local/nginx/sbin/nginx && -s /usr/local/apache/bin/httpd && -s /usr/local/apache/conf/httpd.conf && -s /etc/init.d/httpd && ! -s /usr/local/php/sbin/php-fpm ]]; then + Get_Stack="lnmpa" + elif [[ -s /usr/local/apache/bin/httpd && -s /usr/local/apache/conf/httpd.conf && -s /etc/init.d/httpd && ! -s /usr/local/php/sbin/php-fpm ]]; then + Get_Stack="lamp" + else + Get_Stack="unknow" + fi +} + +Check_DB() +{ + if [[ -s /usr/local/mariadb/bin/mysql && -s /usr/local/mariadb/bin/mysqld_safe && -s /etc/my.cnf ]]; then + MySQL_Bin="/usr/local/mariadb/bin/mysql" + MySQL_Config="/usr/local/mariadb/bin/mysql_config" + MySQL_Dir="/usr/local/mariadb" + Is_MySQL="n" + DB_Name="mariadb" + else + MySQL_Bin="/usr/local/mysql/bin/mysql" + MySQL_Config="/usr/local/mysql/bin/mysql_config" + MySQL_Dir="/usr/local/mysql" + Is_MySQL="y" + DB_Name="mysql" + fi +} + +Verify_DB_Password() +{ + Check_DB + read -p "verify your current database root password: " DB_Root_Password + ${MySQL_Bin} -uroot -p${DB_Root_Password} -e "quit" + if [ $? -eq 0 ]; then + echo "MySQL root password correct." + else + echo "MySQL root password incorrect!Please check!" + Verify_DB_Password + fi + if [ "${DB_Root_Password}" = "" ]; then + Verify_DB_Password + fi +} \ No newline at end of file diff --git a/include/mariadb.sh b/include/mariadb.sh new file mode 100644 index 00000000..af0a339a --- /dev/null +++ b/include/mariadb.sh @@ -0,0 +1,108 @@ +#!/bin/bash + +Mariadb_Sec_Setting() +{ + cat > /etc/ld.so.conf.d/mariadb.conf< /tmp/mariadb_sec_script<> /etc/my.cnf + sed -i '/skip-external-locking/a\max_connections = 1000' /etc/my.cnf + + /etc/init.d/mariadb restart + /etc/init.d/mariadb stop +} + +Install_MariaDB_5() +{ + Echo_Blue "[+] Installing ${Mariadb_Ver}..." + rm -f /etc/my.cnf + Tar_Cd ${Mariadb_Ver}.tar.gz ${Mariadb_Ver} + cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DSYSCONFDIR=/etc -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 ${MariaDBMAOpt} + make && make install + + groupadd mariadb + useradd -s /sbin/nologin -M -g mariadb mariadb + + \cp support-files/my-medium.cnf /etc/my.cnf + sed '/skip-external-locking/i\pid-file = /usr/local/mariadb/var/mariadb.pid' -i /etc/my.cnf + sed '/skip-external-locking/i\log_error = /usr/local/mariadb/var/mariadb.err' -i /etc/my.cnf + sed '/skip-external-locking/i\basedir = /usr/local/mariadb' -i /etc/my.cnf + sed '/skip-external-locking/i\datadir = /usr/local/mariadb/var' -i /etc/my.cnf + sed '/skip-external-locking/i\user = mariadb' -i /etc/my.cnf + if [ "${InstallInnodb}" = "y" ]; then + sed -i 's:#innodb:innodb:g' /etc/my.cnf + sed -i 's:/usr/local/mariadb/data:/usr/local/mariadb/var:g' /etc/my.cnf + else + sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf + fi + + /usr/local/mariadb/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/var --user=mariadb + chown -R mariadb /usr/local/mariadb/var + chgrp -R mariadb /usr/local/mariadb/. + \cp support-files/mysql.server /etc/init.d/mariadb + chmod 755 /etc/init.d/mariadb + + Mariadb_Sec_Setting +} + +Install_MariaDB_10() +{ + Echo_Blue "[+] Installing ${Mariadb_Ver}..." + rm -f /etc/my.cnf + Tar_Cd ${Mariadb_Ver}.tar.gz ${Mariadb_Ver} + cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DSYSCONFDIR=/etc -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 ${MariaDBMAOpt} + make && make install + + groupadd mariadb + useradd -s /sbin/nologin -M -g mariadb mariadb + + \cp support-files/my-medium.cnf /etc/my.cnf + sed '/skip-external-locking/i\pid-file = /usr/local/mariadb/var/mariadb.pid' -i /etc/my.cnf + sed '/skip-external-locking/i\log_error = /usr/local/mariadb/var/mariadb.err' -i /etc/my.cnf + sed '/skip-external-locking/i\basedir = /usr/local/mariadb' -i /etc/my.cnf + sed '/skip-external-locking/i\datadir = /usr/local/mariadb/var' -i /etc/my.cnf + sed '/skip-external-locking/i\user = mariadb' -i /etc/my.cnf + if [ "${InstallInnodb}" = "y" ]; then + sed -i 's:#innodb:innodb:g' /etc/my.cnf + sed -i 's:/usr/local/mariadb/data:/usr/local/mariadb/var:g' /etc/my.cnf + else + sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf + fi + + /usr/local/mariadb/scripts/mysql_install_db --defaults-file=/etc/my.cnf --basedir=/usr/local/mariadb --datadir=/usr/local/mariadb/var --user=mariadb + chown -R mariadb /usr/local/mariadb/var + chgrp -R mariadb /usr/local/mariadb/. + \cp support-files/mysql.server /etc/init.d/mariadb + chmod 755 /etc/init.d/mariadb + + Mariadb_Sec_Setting +} \ No newline at end of file diff --git a/include/memcached.sh b/include/memcached.sh new file mode 100644 index 00000000..418ca2b3 --- /dev/null +++ b/include/memcached.sh @@ -0,0 +1,142 @@ +#!/bin/bash + +Install_PHPMemcache() +{ + echo "Install memcache php extension..." + cd ${cur_dir}/src + Download_Files ${Download_Mirror}/web/memcache/${PHPMemcache_Ver}.tgz ${PHPMemcache_Ver}.tgz + Tar_Cd ${PHPMemcache_Ver}.tgz ${PHPMemcache_Ver} + /usr/local/php/bin/phpize + ./configure --with-php-config=/usr/local/php/bin/php-config + make && make install + cd ../ +} + +Install_PHPMemcached() +{ + echo "Install memcached php extension..." + cd ${cur_dir}/src + Get_Dist_Name + if [ "$PM" = "yum" ]; then + yum install cyrus-sasl-devel -y + Get_CentOS_Version + if [ "${CentOS_Version}" = "5" ]; then + yum install gcc44 gcc44-c++ libstdc++44-devel -y + export CC="gcc44" + export CXX="g++44" + fi + elif [ "$PM" = "apt" ]; then + apt-get install libsasl2-2 sasl2-bin libsasl2-2 libsasl2-dev libsasl2-modules -y + fi + Download_Files ${Download_Mirror}/web/libmemcached/${Libmemcached_Ver}.tar.gz + Tar_Cd ${Libmemcached_Ver}.tar.gz ${Libmemcached_Ver} + ./configure --prefix=/usr/local/libmemcached --with-memcached + make && make install + cd ../ + + Download_Files ${Download_Mirror}/web/php-memcached/${PHPMemcached_Ver}.tgz ${PHPMemcached_Ver}.tgz + Tar_Cd ${PHPMemcached_Ver}.tgz ${PHPMemcached_Ver} + /usr/local/php/bin/phpize + ./configure --with-php-config=/usr/local/php/bin/php-config --enable-memcached --with-libmemcached-dir=/usr/local/libmemcached + make && make install + cd ../ +} + +Install_Memcached() +{ + ver="1" + echo "Which memcached php extension do you choose:" + echo "Install php-memcache,(Discuz x) please enter: 1" + echo "Install php-memcached, please enter: 2" + read -p "Enter 1 or 2 (Default 1): " ver + + if [ "${ver}" = "1" ]; then + echo "You choose php-memcache" + PHP_ZTS="memcache.so" + elif [ "${ver}" = "2" ]; then + echo "You choose php-memcached" + PHP_ZTS="memcached.so" + else + ver="1" + echo "You choose php-memcache" + PHP_ZTS="memcache.so" + fi + + echo "====== Installing memcached ======" + Press_Install + + Get_PHP_Ext_Dir + zend_ext=${zend_ext_dir}${PHP_ZTS} + if [ -s "${zend_ext}" ]; then + rm -f "${zend_ext}" + fi + + if echo "${Cur_PHP_Version}" | grep -Eqi '^5.2.';then + sed -i "s#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\nextension = \"${PHP_ZTS}\"\n#" /usr/local/php/etc/php.ini + elif echo "${Cur_PHP_Version}" | grep -Eqi '^5.[3456].';then + sed -i "/the dl()/i\ +extension = \"${PHP_ZTS}\"" /usr/local/php/etc/php.ini + else + echo "Error: can't get php version!" + echo "Maybe php was didn't install or php configuration file has errors.Please check." + sleep 3 + exit 1 + fi + + echo "Install memcached..." + cd ${cur_dir}/src + Download_Files ${Download_Mirror}/web/memcached/${Memcached_Ver}.tar.gz ${Memcached_Ver}.tar.gz + Tar_Cd ${Memcached_Ver}.tar.gz ${Memcached_Ver} + ./configure --prefix=/usr/local/memcached + make &&make install + cd ../ + + ln /usr/local/memcached/bin/memcached /usr/bin/memcached + + \cp ${cur_dir}/init.d/init.d.memcached /etc/init.d/memcached + chmod +x /etc/init.d/memcached + useradd -s /sbin/nologin nobody + + if [ ! -d /var/lock/subsys ]; then + mkdir -p /var/lock/subsys + fi + + StartUp memcached + + if [ "${ver}" = "1" ]; then + Install_PHPMemcache + elif [ "${ver}" = "2" ]; then + Install_PHPMemcached + fi + + echo "Copy Memcached PHP Test file..." + \cp ${cur_dir}/conf/memcached${ver}.php /home/wwwroot/default/memcached.php + + Restart_PHP + + echo "Starting Memcached..." + /etc/init.d/memcached start + + if [ -s ${zend_ext} ]; then + echo "====== Memcached install completed ======" + echo "Memcached installed successfully, enjoy it!" + else + sed -i '/${PHP_ZTS}/d' /usr/local/php/etc/php.ini + echo "Memcached install failed!" + fi +} + +Uninstall_Memcached() +{ + echo "You will uninstall Memcached..." + Press_Start + sed -i '/memcache.so/d' /usr/local/php/etc/php.ini + sed -i '/memcached.so/d' /usr/local/php/etc/php.ini + Restart_PHP + Remove_StartUp memcached + echo "Delete Memcached files..." + rm -rf /usr/local/libmemcached + rm -rf /usr/local/memcached + rm -rf /etc/init.d/memcached + echo "Uninstall Memcached completed." +} \ No newline at end of file diff --git a/include/mysql.sh b/include/mysql.sh new file mode 100644 index 00000000..abe89f07 --- /dev/null +++ b/include/mysql.sh @@ -0,0 +1,259 @@ +#!/bin/bash + +Deb_Check_MySQL() +{ + apt-get purge -y mysql-client mysql-server mysql-common mysql-server-core-5.5 mysql-client-5.5 + rm -f /etc/my.cnf + rm -rf /etc/mysql/ +} + +MySQL_ARM_Patch() +{ + Get_ARM + if [ "${Is_ARM}" = "y" ]; then + patch -p1 < ${cur_dir}/src/patch/mysql-5.5-fix-arm-client_plugin.patch + fi +} + +MySQL_Sec_Setting() +{ + if [ -d "/proc/vz" ];then + ulimit -s unlimited + fi + /etc/init.d/mysql start + + ln -sf /usr/local/mysql/bin/mysql /usr/bin/mysql + ln -sf /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump + ln -sf /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk + ln -sf /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe + + /usr/local/mysql/bin/mysqladmin -u root password ${MysqlRootPWD} + + cat > /tmp/mysql_sec_script<> /etc/my.cnf + sed -i '/skip-external-locking/a\max_connections = 1000' /etc/my.cnf + + /etc/init.d/mysql restart + /etc/init.d/mysql stop +} + +Install_MySQL_51() +{ + Echo_Blue "[+] Installing ${Mysql_Ver}..." + rm -f /etc/my.cnf + Tar_Cd ${Mysql_Ver}.tar.gz ${Mysql_Ver} + if [ "${InstallInnodb}" = "y" ]; then + ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase ${MySQL51MAOpt} + else + ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile ${MySQL51MAOpt} + fi + sed -i '/set -ex;/,/done/d' Makefile + make && make install + cd ../ + + groupadd mysql + useradd -s /sbin/nologin -M -g mysql mysql + + \cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf + sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf + if [ "${InstallInnodb}" = "y" ]; then + sed -i 's:#innodb:innodb:g' /etc/my.cnf + fi + /usr/local/mysql/bin/mysql_install_db --user=mysql + chown -R mysql /usr/local/mysql/var + chgrp -R mysql /usr/local/mysql/. + \cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql + chmod 755 /etc/init.d/mysql + + cat > /etc/ld.so.conf.d/mysql.conf< /etc/ld.so.conf.d/mysql.conf< /etc/my.cnf< /etc/ld.so.conf.d/mysql.conf</home/wwwroot/default/.user.ini<>/usr/local/php/etc/php.ini<>/usr/local/php/etc/php.ini<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf</home/wwwroot/default/phpinfo.php< +eof + + echo "Copy PHP Prober..." + cd ${cur_dir}/src + tar zxf p.tar.gz + \cp p.php /home/wwwroot/default/p.php + + \cp ${cur_dir}/conf/index.html /home/wwwroot/default/index.html + \cp ${cur_dir}/conf/lnmp.gif /home/wwwroot/default/lnmp.gif + echo "============================Install PHPMyAdmin=================================" + [[ -d /home/wwwroot/default/phpmyadmin ]] && rm -rf /home/wwwroot/default/phpmyadmin + tar zxf ${PhpMyAdmin_Ver}.tar.gz + mv ${PhpMyAdmin_Ver} /home/wwwroot/default/phpmyadmin + \cp ${cur_dir}/conf/config.inc.php /home/wwwroot/default/phpmyadmin/config.inc.php + sed -i 's/LNMPORG/LNMP.org'$RANDOM'VPSer.net/g' /home/wwwroot/default/phpmyadmin/config.inc.php + mkdir /home/wwwroot/default/phpmyadmin/{upload,save} + chmod 755 -R /home/wwwroot/default/phpmyadmin/ + chown www:www -R /home/wwwroot/default/phpmyadmin/ + echo "============================phpMyAdmin install completed=======================" + + #add iptables firewall rules + if [ -s /sbin/iptables ]; then + /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT + /sbin/iptables -I INPUT -p tcp --dport 3306 -j DROP + /sbin/iptables-save + fi +} + +Check_PHP53_Curl() +{ + if [ "${DISTRO}" = "Fedora" ];then + PHP53_With_Curl='y' + elif echo "${Ubuntu_Version}" | grep -Eqi '^14.1';then + PHP53_With_Curl='y' + elif echo "${Ubuntu_Version}" | grep -Eqi '^15.';then + PHP53_With_Curl='y' + elif echo "${Debian_Version}" | grep -Eqi '^8.';then + PHP53_With_Curl='y' + fi +} \ No newline at end of file diff --git a/include/redis.sh b/include/redis.sh new file mode 100644 index 00000000..2826eeb3 --- /dev/null +++ b/include/redis.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +Install_Redis() +{ + ver="1" + echo "Which version do you want to install:" + echo "Install Redis 3.0.1 Stable Version please type: 1" + echo "Install Redis 2.8.20 Old Version please type: 2" + read -p "Enter 1 or 2 (Default Stable version): " ver + if [ "${ver}" = "" ]; then + ver="1" + fi + + if [ "${ver}" = "1" ]; then + echo "You will install Redis 3.0.1 Stable Version" + elif [ "${ver}" = "2" ]; then + echo "You will install Redis 2.8.20 Old Version" + else + echo "Input error,please input 1 or 2 !" + echo "Please Rerun $0" + exit 1 + fi + + echo "====== Installing Redis ======" + Press_Install + + Get_PHP_Ext_Dir + zend_ext="${zend_ext_dir}redis.so" + if [ -s "${zend_ext}" ]; then + rm -f "${zend_ext}" + fi + + sed -i '/the dl()/i\ + extension = "redis.so"' /usr/local/php/etc/php.ini + + cd ${cur_dir}/src + if [ "${ver}" = "1" ]; then + Download_Files http://download.redis.io/releases/${Redis_Stable_Ver}.tar.gz ${Redis_Stable_Ver}.tar.gz + Tar_Cd ${Redis_Stable_Ver}.tar.gz ${Redis_Stable_Ver} + else + Download_Files http://download.redis.io/releases/${Redis_Old_Ver}.tar.gz ${Redis_Old_Ver}.tar.gz + Tar_Cd ${Redis_Old_Ver}.tar.gz ${Redis_Old_Ver} + fi + + if [ "${Is_64bit}" = "y" ] ; then + make PREFIX=/usr/local/redis install + else + make CFLAGS="-march=i686" PREFIX=/usr/local/redis install + fi + mkdir -p /usr/local/redis/etc/ + \cp redis.conf /usr/local/redis/etc/ + sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/etc/redis.conf + cd ../ + + if [ -s ${PHPRedis_Ver} ]; then + rm -rf ${PHPRedis_Ver} + fi + sed -i '/redis.so/d' /usr/local/php/etc/php.ini + + Download_Files http://pecl.php.net/get/${PHPRedis_Ver}.tgz ${PHPRedis_Ver}.tgz + Tar_Cd ${PHPRedis_Ver}.tgz ${PHPRedis_Ver} + /usr/local/php/bin/phpize + ./configure --with-php-config=/usr/local/php/bin/php-config + make && make install + cd ../ + +sed -i '/the dl()/i\ +extension = "redis.so"' /usr/local/php/etc/php.ini + + \cp ${cur_dir}/init.d/init.d.redis /etc/init.d/redis + chmod +x /etc/init.d/redis + echo "Add to auto start..." + StartUp redis + Restart_PHP + /etc/init.d/redis start + + echo "====== Redis install completed ======" + echo "Redis installed successfully, enjoy it!" +} + +Uninstall_Redis() +{ + echo "You will uninstall Redis..." + Press_Start + sed -i '/redis.so/d' /usr/local/php/etc/php.ini + Restart_PHP + Remove_StartUp redis + echo "Delete Redis files..." + rm -rf /usr/local/redis + rm -rf /etc/init.d/redis + echo "Uninstall Redis completed." +} \ No newline at end of file diff --git a/include/upgrade_mariadb.sh b/include/upgrade_mariadb.sh new file mode 100644 index 00000000..40e9691e --- /dev/null +++ b/include/upgrade_mariadb.sh @@ -0,0 +1,188 @@ +#!/bin/bash + +Verify_MariaDB_Password() +{ + read -p "verify your current MySQL root password:" mariadb_root_password + /usr/local/mariadb/bin/mysql -uroot -p${mysql_root_password} -e "quit" + if [ $? -eq 0 ]; then + echo "MariaDB root password correct." + else + echo "MariaDB root password incorrect!Please check!" + Verify_MySQL_Password + fi +} + +Backup_MariaDB() +{ + echo "Starting backup all databases..." + echo "If the database is large, the backup time will be longer." + /usr/local/mariadb/bin/mysqldump -uroot -p${mariadb_root_password} --all-databases > /root/mariadb_all_backup$(date +"%Y%m%d").sql + if [ $? -eq 0 ]; then + echo "MariaDB databases backup successfully."; + else + echo "MariaDB databases backup failed,Please backup databases manually!" + exit 1 + fi + lnmp stop + + mv /etc/init.d/mariadb /etc/init.d/mariadb.bak.${Upgrade_Date} + mv /etc/my.cnf /etc/my.conf.mariadb.bak.${Upgrade_Date} + mv /usr/local/mariadb /usr/local/oldmariadb${Upgrade_Date} +} + +Upgrade_MariaDB() +{ + cur_mariadb_version=`/usr/local/mariadb/bin/mysql -V | awk '{print $5}' | tr -d "\-MariaDB,"` + + Check_DB + if [ "${Is_MySQL}" = "y" ]; then + Echo_Red "Current database was MySQL, Can't run MariaDB upgrade script." + fi + + Verify_MariaDB_Password + + mariadb_version="" + echo "Current MariaDB Version:${cur_mariadb_version}" + echo "You can get version number from https://downloads.mariadb.org/" + echo "Please enter MariaDB Version you want." + read -p "(example: 10.0.15 ): " mariadb_version + if [ "${mariadb_version}" = "" ]; then + echo "Error: You must input MariaDB Version!!" + exit 1 + fi + + #do you want to install the InnoDB Storage Engine? + echo "===========================" + + installinnodb="y" + echo "Do you want to install the InnoDB Storage Engine?" + read -p "(Default yes,if you want please input: y ,if not please enter: n):" installinnodb + + case "${installinnodb}" in + y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) + echo "You will install the InnoDB Storage Engine" + installinnodb="y" + ;; + n|N|No|NO|no|nO) + echo "You will NOT install the InnoDB Storage Engine!" + installinnodb="n" + ;; + *) + echo "No input,The InnoDB Storage Engine will enable." + installinnodb="y" + esac + + echo "=====================================================================" + echo "You will upgrade MariaDB V${cur_mysql_version} to V${mariadb_version}" + echo "=====================================================================" + + Press_Start + + echo "============================check files==================================" + cd ${cur_dir}/src + if [ -s mariadb-${mariadb_version}.tar.gz ]; then + echo "mariadb-${mariadb_version}.tar.gz [found]" + else + echo "Error: mariadb-${mariadb_version}.tar.gz not found!!!download now......" + wget -c https://downloads.mariadb.org/interstitial/mariadb-${mariadb_version}/source/mariadb-${mariadb_version}.tar.gz + if [ $? -eq 0 ]; then + echo "Download mariadb-${mariadb_version}.tar.gz successfully!" + else + wget -c https://downloads.mariadb.org/interstitial/mariadb-${mariadb_version}/kvm-tarbake-jaunty-x86/mariadb-${mariadb_version}.tar.gz + if [ $? -eq 0 ]; then + echo "Download mariadb-${mariadb_version}.tar.gz successfully!" + else + echo "You enter MariaDB Version was:"${mariadb_version} + Echo_Red "Error! You entered a wrong version number, please check!" + sleep 5 + exit 1 + fi + fi + fi + echo "============================check files==================================" + + Backup_MariaDB + + echo "Starting upgrade MariaDB..." + Tar_Cd mariadb-${mariadb_version}.tar.gz mariadb-${mariadb_version} + cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 + make && make install + + groupadd mariadb + useradd -s /sbin/nologin -M -g mariadb mariadb + + \cp support-files/my-medium.cnf /etc/my.cnf + sed '/skip-external-locking/i\pid-file = /usr/local/mariadb/var/mariadb.pid' -i /etc/my.cnf + sed '/skip-external-locking/i\log_error = /usr/local/mariadb/var/mariadb.err' -i /etc/my.cnf + sed '/skip-external-locking/i\basedir = /usr/local/mariadb' -i /etc/my.cnf + sed '/skip-external-locking/i\datadir = /usr/local/mariadb/var' -i /etc/my.cnf + sed '/skip-external-locking/i\user = mariadb' -i /etc/my.cnf + if [ $installinnodb = "y" ]; then + sed -i 's:#innodb:innodb:g' /etc/my.cnf + sed -i 's:/usr/local/mariadb/data:/usr/local/mariadb/var:g' /etc/my.cnf + else + sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf + fi + + echo -e "\nexpire_logs_days = 10" >> /etc/my.cnf + sed -i '/skip-external-locking/a\max_connections = 1000' /etc/my.cnf + +cat > /etc/ld.so.conf.d/mariadb.conf< /tmp/mariadb_sec_script< /root/mysql_all_backup$(date +"%Y%m%d").sql + if [ $? -eq 0 ]; then + echo "MySQL databases backup successfully."; + else + echo "MySQL databases backup failed,Please backup databases manually!" + exit 1 + fi + lnmp stop + mv /etc/init.d/mysql /etc/init.d/mysql.bak.${Upgrade_Date} + mv /etc/my.cnf /etc/my.conf.bak.${Upgrade_Date} + mv /usr/local/mysql /usr/local/oldmysql${Upgrade_Date} +} + +Upgrade_MySQL51() +{ + Tar_Cd mysql-${mysql_version}.tar.gz mysql-${mysql_version} + if [ $installinnodb = "y" ]; then + ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase + else + ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile + fi + sed -i '/set -ex;/,/done/d' Makefile + make && make install + cd ../ + + groupadd mysql + useradd -s /sbin/nologin -g mysql mysql + \cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf + sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf + if [ $installinnodb = "y" ]; then + sed -i 's:#innodb:innodb:g' /etc/my.cnf + sed -i 's:/usr/local/mysql/data:/usr/local/mysql/var:g' /etc/my.cnf + else + sed '/skip-external-locking/i\nloose-skip-innodb' -i /etc/my.cnf + fi +} + +Upgrade_MySQL55() { + echo "Starting upgrade MySQL..." + + Tar_Cd mysql-${mysql_version}.tar.gz mysql-${mysql_version} + patch -p1 < ${cur_dir}/src/patch/mysql-openssl.patch + cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 + make && make install + + groupadd mysql + useradd -s /sbin/nologin -M -g mysql mysql + + \cp support-files/my-medium.cnf /etc/my.cnf + + sed '/skip-external-locking/i\datadir = /usr/local/mysql/var' -i /etc/my.cnf + if [ $installinnodb = "y" ]; then + sed -i 's:#innodb:innodb:g' /etc/my.cnf + sed -i 's:/usr/local/mysql/data:/usr/local/mysql/var:g' /etc/my.cnf + else + sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf + fi + +cat > /etc/ld.so.conf.d/mysql.conf< /etc/my.cnf< /etc/ld.so.conf.d/mysql.conf<> /etc/my.cnf + sed -i '/skip-external-locking/a\max_connections = 1000' /etc/my.cnf + \cp ${cur_dir}/mysql-${mysql_version}/support-files/mysql.server /etc/init.d/mysql + chmod 755 /etc/init.d/mysql + + ldconfig + + if [ -d "/proc/vz" ];then + ulimit -s unlimited + fi + + echo "Repair databases..." + /usr/local/mysql/bin/mysql_upgrade -u root -p$mysql_root_password + + ln -sf /usr/local/mysql/bin/mysql /usr/bin/mysql + ln -sf /usr/local/mysql/bin/mysqldump /usr/bin/mysqldump + ln -sf /usr/local/mysql/bin/myisamchk /usr/bin/myisamchk + ln -sf /usr/local/mysql/bin/mysqld_safe /usr/bin/mysqld_safe + + lnmp start + if [[ -s /usr/local/mysql/bin/mysql && -s /usr/local/mysql/bin/mysqld_safe && -s /etc/my.cnf ]]; then + Echo_Green "======== upgrade MySQL completed ======" + else + Echo_Red "======== upgrade MySQL failed ======" + Echo_Red "upgrade MySQL log: /root/upgrade_mysql.log" + echo "You upload upgrade_mysql.log to LNMP Forum for help." + fi +} + +Upgrade_MySQL() +{ + upgrade_date=$(date +"%Y%m%d") + + cur_mysql_version=`/usr/local/mysql/bin/mysql -V | awk '{print $5}' | tr -d ","` + + Check_DB + if [ "${Is_MySQL}" = "n" ]; then + Echo_Red "Current database was MariaDB, Can't run MySQL upgrade script." + fi + + Verify_MySQL_Password + + mysql_version="" + echo "Current MYSQL Version:${cur_mysql_version}" + echo "You can get version number from http://dev.mysql.com/downloads/mysql/" + echo "Please input MySQL Version you want." + read -p "(example: 5.5.36 ): " mysql_version + if [ "${mysql_version}" = "" ]; then + echo "Error: You must input MySQL Version!!" + exit 1 + fi + + if [ "${mysql_version}" == "${cur_mysql_version}" ]; then + echo "Error: The upgrade MYSQL Version is the same as the old Version!!" + exit 1 + fi + + #do you want to install the InnoDB Storage Engine? + echo "===========================" + + installinnodb="y" + echo "Do you want to install the InnoDB Storage Engine?" + read -p "(Default yes,if you want please input: y ,if not please enter: n): " installinnodb + + case "${installinnodb}" in + y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) + echo "You will install the InnoDB Storage Engine" + installinnodb="y" + ;; + n|N|No|NO|no|nO) + echo "You will NOT install the InnoDB Storage Engine!" + installinnodb="n" + ;; + *) + echo "No input,The InnoDB Storage Engine will enable." + installinnodb="y" + esac + + mysql_short_version=`echo ${mysql_version} | cut -d. -f1-2` + + echo "==================================================" + echo "You want to upgrade MySQL Version to ${mysql_version}" + echo "==================================================" + + Press_Start + + echo "============================check files==================================" + cd ${cur_dir}/src + if [ -s mysql-${mysql_version}.tar.gz ]; then + echo "mysql-${mysql_version}.tar.gz [found]" + else + echo "Error: mysql-${mysql_version}.tar.gz not found!!!download now......" + wget -c http://cdn.mysql.com/Downloads/MySQL-${mysql_short_version}/mysql-${mysql_version}.tar.gz + if [ $? -eq 0 ]; then + echo "Download mysql-${mysql_version}.tar.gz successfully!" + else + echo "You enter MySQL Version was:"${mysql_version} + Echo_Red "Error! You entered a wrong version number, please check!" + sleep 5 + exit 1 + fi + fi + echo "============================check files==================================" + + Backup_MySQL + if [ "${mysql_short_version}" = "5.1" ]; then + Upgrade_MySQL51 + elif [ "${mysql_short_version}" = "5.5" ]; then + Upgrade_MySQL55 + elif [[ "${mysql_short_version}" = "5.6" || "${mysql_short_version}" = "5.7" ]]; then + Upgrade_MySQL56 + fi + StartAll +} diff --git a/include/upgrade_mysql2mariadb.sh b/include/upgrade_mysql2mariadb.sh new file mode 100644 index 00000000..7096cd61 --- /dev/null +++ b/include/upgrade_mysql2mariadb.sh @@ -0,0 +1,198 @@ +#!/bin/bash + +Verify_MySQL_Password() +{ + read -p "verify your current MySQL root password:" mysql_root_password + /usr/local/mysql/bin/mysql -uroot -p${mysql_root_password} -e "quit" + if [ $? -eq 0 ]; then + echo "MySQL root password correct." + else + echo "MySQL root password incorrect!Please check!" + Verify_MySQL_Password + fi +} + +Backup_MySQL() +{ + echo "Starting backup all databases..." + echo "If the database is large, the backup time will be longer." + /usr/local/mysql/bin/mysqldump -uroot -p${mysql_root_password} --all-databases > /root/mysql_all_backup$(date +"%Y%m%d").sql + if [ $? -eq 0 ]; then + echo "MySQL databases backup successfully."; + else + echo "MySQL databases backup failed,Please backup databases manually!" + exit 1 + fi + lnmp stop + echo "Remove autostart..." + if [ -s /etc/debian_version ]; then + update-rc.d -f mysql remove + elif [ -s /etc/redhat-release ]; then + chkconfig mysql off + fi + mv /etc/init.d/mysql /etc/init.d/mysql2mariadb.bak.${Upgrade_Date} + mv /etc/my.cnf /etc/my.conf.mysql2mariadbbak.${Upgrade_Date} + mv /usr/local/mysql /usr/local/mysql2mariadb${Upgrade_Date} +} + +Upgrade_MySQL2MariaDB() +{ + cur_mysql_version=`/usr/local/mysql/bin/mysql -V | awk '{print $5}' | tr -d ","` + + Verify_MySQL_Password + + Check_DB + if [ "${Is_MySQL}" = "n" ]; then + Echo_Red "Current database was MariaDB, Can't run MySQL2MariaDB upgrade script." + fi + + mariadb_version="" + echo "Current MySQL Version:${cur_mysql_version}" + echo "You can get version number from https://downloads.mariadb.org/" + echo "Please enter MariaDB Version you want." + read -p "(example: 10.0.15 ): " mariadb_version + if [ "${mariadb_version}" = "" ]; then + echo "Error: You must input MariaDB Version!!" + exit 1 + fi + + #do you want to install the InnoDB Storage Engine? + echo "===========================" + + installinnodb="y" + echo "Do you want to install the InnoDB Storage Engine?" + read -p "(Default yes,if you want please input: y ,if not please enter: n):" installinnodb + + case "${installinnodb}" in + y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) + echo "You will install the InnoDB Storage Engine" + installinnodb="y" + ;; + n|N|No|NO|no|nO) + echo "You will NOT install the InnoDB Storage Engine!" + installinnodb="n" + ;; + *) + echo "No input,The InnoDB Storage Engine will enable." + installinnodb="y" + esac + + echo "=====================================================================" + echo "You will upgrade MySQL V${cur_mysql_version} to MariaDB V${mariadb_version}" + echo "=====================================================================" + + Press_Start + + echo "============================check files==================================" + cd ${cur_dir}/src + if [ -s mariadb-${mariadb_version}.tar.gz ]; then + echo "mariadb-${mariadb_version}.tar.gz [found]" + else + echo "Error: mariadb-${mariadb_version}.tar.gz not found!!!download now......" + wget -c https://downloads.mariadb.org/interstitial/mariadb-${mariadb_version}/source/mariadb-${mariadb_version}.tar.gz + if [ $? -eq 0 ]; then + echo "Download mariadb-${mariadb_version}.tar.gz successfully!" + else + wget -c https://downloads.mariadb.org/interstitial/mariadb-${mariadb_version}/kvm-tarbake-jaunty-x86/mariadb-${mariadb_version}.tar.gz + if [ $? -eq 0 ]; then + echo "Download mariadb-${mariadb_version}.tar.gz successfully!" + else + echo "You enter MySQL Version was:"${mariadb_version} + Echo_Red "Error! You entered a wrong version number, please check!" + sleep 5 + exit 1 + fi + fi + fi + echo "============================check files==================================" + + Backup_MySQL + + echo "Starting upgrade MySQL to MariaDB..." + Tar_Cd mariadb-${mariadb_version}.tar.gz mariadb-${mariadb_version} + cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=bundled -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 + make && make install + + groupadd mariadb + useradd -s /sbin/nologin -M -g mariadb mariadb + + \cp support-files/my-medium.cnf /etc/my.cnf + sed '/skip-external-locking/i\pid-file = /usr/local/mariadb/var/mariadb.pid' -i /etc/my.cnf + sed '/skip-external-locking/i\log_error = /usr/local/mariadb/var/mariadb.err' -i /etc/my.cnf + sed '/skip-external-locking/i\basedir = /usr/local/mariadb' -i /etc/my.cnf + sed '/skip-external-locking/i\datadir = /usr/local/mariadb/var' -i /etc/my.cnf + sed '/skip-external-locking/i\user = mariadb' -i /etc/my.cnf + if [ $installinnodb = "y" ]; then + sed -i 's:#innodb:innodb:g' /etc/my.cnf + sed -i 's:/usr/local/mariadb/data:/usr/local/mariadb/var:g' /etc/my.cnf + else + sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf + fi + + echo -e "\nexpire_logs_days = 10" >> /etc/my.cnf + sed -i '/skip-external-locking/a\max_connections = 1000' /etc/my.cnf + +cat > /etc/ld.so.conf.d/mariadb.conf< /tmp/mariadb_sec_script<&1 | cut -c22-` + + Nginx_Version="" + echo "Current Nginx Version:${Cur_Nginx_Version}" + echo "You can get version number from http://nginx.org/en/download.html" + read -p "Please enter nginx version you want, (example: 1.7.8 ): " Nginx_Version + if [ "${Nginx_Version}" = "" ]; then + echo "Error: You must enter a nginx version!!" + exit 1 + fi + echo "+---------------------------------------------------------+" + echo "| You will upgrade nginx version to ${Nginx_Version}" + echo "+---------------------------------------------------------+" + + Press_Start + + echo "============================check files==================================" + cd ${cur_dir}/src + if [ -s nginx-${Nginx_Version}.tar.gz ]; then + echo "nginx-${Nginx_Version}.tar.gz [found]" + else + echo "Error: nginx-${Nginx_Version}.tar.gz not found!!!download now......" + wget -c http://nginx.org/download/nginx-${Nginx_Version}.tar.gz + if [ $? -eq 0 ]; then + echo "Download nginx-${Nginx_Version}.tar.gz successfully!" + else + echo "You enter Nginx Version was:"${Nginx_Version} + Echo_Red "Error! You entered a wrong version number, please check!" + sleep 5 + exit 1 + fi + fi + echo "============================check files==================================" + + Tar_Cd nginx-${Nginx_Version}.tar.gz nginx-${Nginx_Version} + ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_spdy_module --with-http_gzip_static_module --with-ipv6 --with-http_sub_module ${Nginx_Modules_Arguments} + make + + mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.${Upgrade_Date} + \cp objs/nginx /usr/local/nginx/sbin/nginx + echo "Test nginx configure file..." + /usr/local/nginx/sbin/nginx -t + echo "upgrade..." + make upgrade + Echo_Green "======== upgrade nginx completed ======" + echo "Program will display Nginx Version......" + /usr/local/nginx/sbin/nginx -v +} \ No newline at end of file diff --git a/include/upgrade_php.sh b/include/upgrade_php.sh new file mode 100644 index 00000000..ac079915 --- /dev/null +++ b/include/upgrade_php.sh @@ -0,0 +1,566 @@ +#!/bin/bash + +Check_Stack_Choose() +{ + Check_Stack + if [[ "${Get_Stack}" = "lnmp" && "${Stack}" = "" ]]; then + echo "Current Stack: ${Get_Stack},please run: ./upgrade.sh php" + sleep 3 + exit 1 + elif [[ "${Get_Stack}" = "lnmpa" || "${Get_Stack}" = "lamp" ]] && [[ "${Stack}" = "lnmp" ]]; then + echo "Current Stack: ${Get_Stack},please run: ./upgrade.sh phpa" + sleep 3 + exit 1 + fi +} + +Start_Upgrade_PHP() +{ + Check_Stack_Choose + Check_DB + php_version="" + Get_PHP_Ext_Dir + echo "Current PHP Version:${Cur_PHP_Version}" + echo "You can get version number from http://www.php.net/" + read -p "Please enter a PHP Version you want: " php_version + if [ "${php_version}" = "" ]; then + echo "Error: You must enter a corrent php version!!" + exit 1 + fi + Press_Start + if [ -s php-${php_version}.tar.gz ]; then + echo "php-${php_version}.tar.gz [found]" + else + echo "Error: php-$php_version.tar.gz not found!!!download now..." + cd ${cur_dir}/src + wget -c http://www.php.net/distributions/php-${php_version}.tar.gz + if [ $? -eq 0 ]; then + echo "Download php-${php_version}.tar.gz successfully!" + else + wget -c http://museum.php.net/php5/php-${php_version}.tar.gz + if [ $? -eq 0 ]; then + echo "Download php-${php_version}.tar.gz successfully!" + else + echo "You enter PHP Version was:"${php_version} + Echo_Red "Error! You entered a wrong version number, please check!" + sleep 5 + exit 1 + fi + fi + fi + + if echo "${php_version}" | grep -Eqi '^5.2.';then + Download_Files ${Download_Mirror}/web/phpfpm/php-${php_version}-fpm-0.5.14.diff.gz php-${php_version}-fpm-0.5.14.diff.gz + fi + lnmp stop + + if [ "${Stack}" = "lnmp" ]; then + mv /etc/init.d/php-fpm /etc/init.d/php-fpm.bak.${Upgrade_Date} + mv /usr/local/php /usr/local/oldphp${Upgrade_Date} + else + mv /usr/local/apache/modules/libphp5.so /usr/local/apache/modules/libphp5.so.bak.${Upgrade_Date} + mv /usr/local/php /usr/local/oldphp${Upgrade_Date} + fi + +} + +Check_Curl() +{ + if [ -s /usr/local/curl/bin/curl ]; then + Echo_Green "Curl ...ok" + else + Install_Curl + fi +} + +Check_PHP53_Curl() +{ + if [ "${DISTRO}" = "Fedora" ];then + PHP53_With_Curl='y' + elif echo "${Ubuntu_Version}" | grep -Eqi '^14.1';then + PHP53_With_Curl='y' + elif echo "${Ubuntu_Version}" | grep -Eqi '^15.';then + PHP53_With_Curl='y' + elif echo "${Debian_Version}" | grep -Eqi '^8.';then + PHP53_With_Curl='y' + fi +} + +Check_Autoconf() +{ + if [[ -s /usr/local/autoconf-2.13/bin/autoconf && -s /usr/local/autoconf-2.13/bin/autoheader ]]; then + Echo_Green "Autconf 2.13...ok" + export PHP_AUTOCONF=/usr/local/autoconf-2.13/bin/autoconf + export PHP_AUTOHEADER=/usr/local/autoconf-2.13/bin/autoheader + else + Install_Autoconf + fi +} + +Ln_PHP_Bin() +{ + ln -sf /usr/local/php/bin/php /usr/bin/php + ln -sf /usr/local/php/bin/phpize /usr/bin/phpize + ln -sf /usr/local/php/bin/pear /usr/bin/pear + ln -sf /usr/local/php/bin/pecl /usr/bin/pecl + if [ "${Stack}" = "lnmp" ]; then + ln -sf /usr/local/php/sbin/php-fpm /usr/bin/php-fpm + fi +} + +Pear_Pecl_Set() +{ + pear config-set php_ini /usr/local/php/etc/php.ini + pecl config-set php_ini /usr/local/php/etc/php.ini +} + +Check_PHP_Upgrade_Files() +{ + if [ "${Stack}" = "lnmp" ]; then + if [[ -s /usr/local/php/sbin/php-fpm && -s /etc/init.d/php-fpm && -s /usr/local/php/etc/php.ini && -s /usr/local/php/bin/php ]]; then + Echo_Green "======== upgrade php completed ======" + else + Echo_Red "======== upgrade php failed ======" + Echo_Red "upgrade php log: /root/upgrade_lnmp_php.log" + echo "You upload upgrade_lnmp_php.log to LNMP Forum for help." + fi + else + if [[ -s /usr/local/apache/modules/libphp5.so && -s /usr/local/php/etc/php.ini && -s /usr/local/php/bin/php ]]; then + Echo_Green "======== upgrade php completed ======" + else + Echo_Red "======== upgrade php failed ======" + Echo_Red "upgrade php log: /root/upgrade_a_php.log" + echo "You upload upgrade_a_php.log to LNMP Forum for help." + fi + fi +} + +Upgrade_PHP_52() +{ + Check_Curl + Check_Autoconf + cd ${cur_dir}/src && rm -rf php-${php_version} + tar zxf php-${php_version}.tar.gz + gzip -cd php-${php_version}-fpm-0.5.14.diff.gz | patch -d php-${php_version} -p1 + cd php-${php_version}/ + patch -p1 < ${cur_dir}/src/patch/php-5.2.17-max-input-vars.patch + patch -p0 < ${cur_dir}/src/patch/php-5.2.17-xml.patch + patch -p1 < ${cur_dir}/src/patch/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch + patch -p1 < ${cur_dir}/src/patch/php-5.2-multipart-form-data.patch + ./buildconf --force + if [ "${Stack}" = "lnmp" ]; then + ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=${MySQL_Dir} --with-mysqli=${MySQL_Config} --with-pdo-mysql=${MySQL_Dir} --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --with-mime-magic + else + ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=${MySQL_Dir} --with-mysqli=${MySQL_Config} --with-pdo-mysql=${MySQL_Dir} --with-iconv-dir --with-freetype-dir=/usr/local/freetype --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --with-mime-magic + fi + make ZEND_EXTRA_LIBS='-liconv' + make install + + mkdir -p /usr/local/php/etc + \cp php.ini-dist /usr/local/php/etc/php.ini + cd ../ + + Ln_PHP_Bin + + # php extensions + sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\n#' /usr/local/php/etc/php.ini + sed -i 's#output_buffering = Off#output_buffering = On#' /usr/local/php/etc/php.ini + sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.ini + sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini + sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini + sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini + sed -i 's/; cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini + sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.ini + sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket/g' /usr/local/php/etc/php.ini + Pear_Pecl_Set + + cd ${cur_dir}/src + if [ "${Is_64bit}" = "y" ] ; then + wget -c ${Download_Mirror}/web/zend/ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz + tar zxf ZendOptimizer-3.3.9-linux-glibc23-x86_64.tar.gz + mkdir -p /usr/local/zend/ + \cp ZendOptimizer-3.3.9-linux-glibc23-x86_64/data/5_2_x_comp/ZendOptimizer.so /usr/local/zend/ + else + wget -c ${Download_Mirror}/web/zend/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz + tar zxf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz + mkdir -p /usr/local/zend/ + \cp ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/ZendOptimizer.so /usr/local/zend/ + fi + + cat >>/usr/local/php/etc/php.ini<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf<>/usr/local/php/etc/php.ini< /dev/null + if [ $? -eq 0 ]; then + echo " done" + else + echo " failed" + fi +} + +do_status() +{ + $DAEMON ping > /dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "fail2ban is running." + else + echo "fail2ban is stop." + fi +} + +do_stop() +{ + echo -n "Stopping fail2ban..." + $DAEMON stop > /dev/null || return 2 + if [ $? -eq 0 ]; then + echo " done" + else + echo " failed" + fi +} + +do_reload() { + echo -n "Reloading fail2ban..." + $DAEMON reload > /dev/null + if [ $? -eq 0 ]; then + echo " done" + else + echo " failed" + fi +} + +command="$1" +case "$command" in + start|force-start) + do_start "$command" + ;; + + stop) + do_stop + ;; + + restart|force-reload) + do_stop + do_start + ;; + + reload|force-reload) + do_reload + ;; + + status) + do_status + ;; + *) + echo "Usage: $SCRIPTNAME {start|force-start|stop|restart|force-reload|status}" >&2 + ;; +esac diff --git a/init.d/init.d.httpd b/init.d/init.d.httpd new file mode 100644 index 00000000..bbc48e23 --- /dev/null +++ b/init.d/init.d.httpd @@ -0,0 +1,113 @@ +#!/bin/sh +# Startup script for the Apache Web Server +# chkconfig: 345 85 15 +# Description: Startup script for Apache webserver on Debian. Place in /etc/init.d and +# run 'update-rc.d -f httpd defaults', or use the appropriate command on your +# distro. For CentOS/Redhat run: 'chkconfig --add httpd' + +### BEGIN INIT INFO +# Provides: httpd +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts Apache Web Server +# Description: starts Apache Web Server +### END INIT INFO + +# Author: licess +# website: http://lnmp.org +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# +# Apache control script designed to allow an easy command line interface +# to controlling Apache. Written by Marc Slemko, 1997/08/23 +# +# The exit codes returned are: +# XXX this doc is no longer correct now that the interesting +# XXX functions are handled by httpd +# 0 - operation completed successfully +# 1 - +# 2 - usage error +# 3 - httpd could not be started +# 4 - httpd could not be stopped +# 5 - httpd could not be started during a restart +# 6 - httpd could not be restarted during a restart +# 7 - httpd could not be restarted during a graceful restart +# 8 - configuration syntax error +# +# When multiple arguments are given, only the error from the _last_ +# one is reported. Run "apachectl help" for usage info +# +ARGV="$@" +# +# |||||||||||||||||||| START CONFIGURATION SECTION |||||||||||||||||||| +# -------------------- -------------------- +# +# the path to your httpd binary, including options if necessary +HTTPD='/usr/local/apache/bin/httpd' +PID='/usr/local/apache/logs/httpd.pid' +# +# pick up any necessary environment variables +if test -f /usr/local/apache/bin/envvars; then + . /usr/local/apache/bin/envvars +fi + +ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`" +# -------------------- -------------------- +# |||||||||||||||||||| END CONFIGURATION SECTION |||||||||||||||||||| + +# Set the maximum number of file descriptors allowed per child process. +if [ "x$ULIMIT_MAX_FILES" != "x" ] ; then + $ULIMIT_MAX_FILES +fi + +ERROR=0 +if [ "x$ARGV" = "x" ] ; then + ARGV="-h" +fi + +case $ARGV in + start|stop|restart|graceful|graceful-stop) + echo -n "$ARGV apache... " + $HTTPD -k $ARGV + if [ "$?" != 0 ] ; then + echo " failed" + else + echo " done" + fi + ;; + configtest) + echo -n "test apache configure... " + $HTTPD -t + if [ "$?" != 0 ] ; then + echo " failed" + else + echo " done" + fi + ;; + status) + if [ -f "$PID" ]; then + echo "Apache is running." + else + echo "Apache is stopped." + fi + ;; + *) + echo $"Usage: $0 {start|stop|restart|graceful|graceful-stop|configtest|status}" + ;; +esac diff --git a/conf/memcached-init b/init.d/init.d.memcached similarity index 65% rename from conf/memcached-init rename to init.d/init.d.memcached index a933bfb4..4d88a1cd 100644 --- a/conf/memcached-init +++ b/init.d/init.d.memcached @@ -1,10 +1,10 @@ #! /bin/bash -# +# # memcached: MemCached Daemon -# +# # chkconfig: - 90 25 # description: MemCached Daemon -# +# ### BEGIN INIT INFO # Provides: memcached # Required-Start: $syslog @@ -29,41 +29,52 @@ prog="memcached" start () { echo -n $"Starting $prog: " memcached -d -p $PORT -u $USER -m $CACHESIZE -c $MAXCONN -P /var/run/memcached.pid $OPTIONS - RETVAL=$? - echo - [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached + if [ "$?" != 0 ] ; then + echo " failed" + exit 1 + else + touch /var/lock/subsys/memcached + echo " done" + fi } stop () { echo -n $"Stopping $prog: " + if [ ! -e /var/run/$prog.pid ]; then + echo -n $"$prog is not running." + exit 1 + fi kill `cat /var/run/memcached.pid` - RETVAL=$? - echo - if [ $RETVAL -eq 0 ] ; then + if [ "$?" != 0 ] ; then + echo " failed" + exit 1 + else rm -f /var/lock/subsys/memcached rm -f /var/run/memcached.pid + echo " done" fi } restart () { - stop - start + $0 stop + sleep 2 + $0 start } - # See how we were called. case "$1" in start) start ;; stop) - stop - ;; + stop + ;; restart|reload) - restart - ;; + restart + ;; *) - echo $"Usage: $0 {start|stop|status|restart|reload}" - exit 1 + echo $"Usage: $0 {start|stop|status|restart|reload}" + exit 1 + ;; esac exit $? diff --git a/init.d/init.d.nginx b/init.d/init.d.nginx new file mode 100644 index 00000000..e58ed47c --- /dev/null +++ b/init.d/init.d.nginx @@ -0,0 +1,120 @@ +#! /bin/sh +# chkconfig: 2345 55 25 +# Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and +# run 'update-rc.d -f nginx defaults', or use the appropriate command on your +# distro. For CentOS/Redhat run: 'chkconfig --add nginx' + +### BEGIN INIT INFO +# Provides: nginx +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts the nginx web server +# Description: starts nginx using start-stop-daemon +### END INIT INFO + +# Author: licess +# website: http://lnmp.org + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +NAME=nginx +NGINX_BIN=/usr/local/nginx/sbin/$NAME +CONFIGFILE=/usr/local/nginx/conf/$NAME.conf +PIDFILE=/usr/local/nginx/logs/$NAME.pid + +case "$1" in + start) + echo -n "Starting $NAME... " + + if netstat -tnpl | grep -q nginx;then + echo "$NAME (pid `pidof $NAME`) already running." + exit 1 + fi + + $NGINX_BIN -c $CONFIGFILE + + if [ "$?" != 0 ] ; then + echo " failed" + exit 1 + else + echo " done" + fi + ;; + + stop) + echo -n "Stoping $NAME... " + + if ! netstat -tnpl | grep -q nginx; then + echo "$NAME is not running." + exit 1 + fi + + $NGINX_BIN -s stop + + if [ "$?" != 0 ] ; then + echo " failed. Use force-quit" + exit 1 + else + echo " done" + fi + ;; + + status) + if netstat -tnpl | grep -q nginx; then + PID=`pidof nginx` + echo "$NAME (pid $PID) is running..." + else + echo "$NAME is stopped" + exit 0 + fi + ;; + + force-quit) + echo -n "Terminating $NAME... " + + if ! netstat -tnpl | grep -q nginx; then + echo "$NAME is not running." + exit 1 + fi + + kill `pidof $NAME` + + if [ "$?" != 0 ] ; then + echo " failed" + exit 1 + else + echo " done" + fi + ;; + + restart) + $0 stop + sleep 1 + $0 start + ;; + + reload) + echo -n "Reload service $NAME... " + + if netstat -tnpl | grep -q nginx; then + $NGINX_BIN -s reload + echo " done" + else + echo "$NAME is not running, can't reload." + exit 1 + fi + ;; + + configtest) + echo -n "Test $NAME configure files... " + + $NGINX_BIN -t + ;; + + *) + echo "Usage: $0 {start|stop|force-quit|restart|reload|status|configtest}" + exit 1 + ;; + +esac \ No newline at end of file diff --git a/init.d/init.d.php-fpm5.2 b/init.d/init.d.php-fpm5.2 new file mode 100644 index 00000000..2df72ac1 --- /dev/null +++ b/init.d/init.d.php-fpm5.2 @@ -0,0 +1,166 @@ +#! /bin/sh +# chkconfig: 2345 55 25 +# Description: Startup script for php-fpm on Debian. Place in /etc/init.d and +# run 'update-rc.d -f php-fpm defaults', or use the appropriate command on your +# distro. For CentOS/Redhat run: 'chkconfig --add php-fpm' + +### BEGIN INIT INFO +# Provides: php-fpm +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts php-fpm +# Description: starts php-fpm +### END INIT INFO + +# Author: licess +# website: http://lnmp.org + +php_fpm_BIN=/usr/local/php/bin/php-cgi +php_fpm_CONF=/usr/local/php/etc/php-fpm.conf +php_fpm_PID=/usr/local/php/logs/php-fpm.pid + + +php_opts="--fpm-config $php_fpm_CONF" + + +wait_for_pid () { + try=0 + + while test $try -lt 35 ; do + + case "$1" in + 'created') + if [ -f "$2" ] ; then + try='' + break + fi + ;; + + 'removed') + if [ ! -f "$2" ] ; then + try='' + break + fi + ;; + esac + + echo -n . + try=`expr $try + 1` + sleep 1 + + done + +} + +case "$1" in + start) + echo -n "Starting php_fpm " + + $php_fpm_BIN --fpm $php_opts + + if [ "$?" != 0 ] ; then + echo " failed" + exit 1 + fi + + wait_for_pid created $php_fpm_PID + + if [ -n "$try" ] ; then + echo " failed" + exit 1 + else + echo " done" + fi + ;; + + stop) + echo -n "Shutting down php_fpm " + + if [ ! -r $php_fpm_PID ] ; then + echo "warning, no pid file found - php-fpm is not running ?" + exit 1 + fi + + kill -TERM `cat $php_fpm_PID` + + wait_for_pid removed $php_fpm_PID + + if [ -n "$try" ] ; then + echo " failed" + exit 1 + else + echo " done" + fi + ;; + + quit) + echo -n "Gracefully shutting down php_fpm " + + if [ ! -r $php_fpm_PID ] ; then + echo "warning, no pid file found - php-fpm is not running ?" + exit 1 + fi + + kill -QUIT `cat $php_fpm_PID` + + wait_for_pid removed $php_fpm_PID + + if [ -n "$try" ] ; then + echo " failed" + exit 1 + else + echo " done" + fi + ;; + + restart) + $0 stop + $0 start + ;; + + reload) + + echo -n "Reload service php-fpm " + + if [ ! -r $php_fpm_PID ] ; then + echo "warning, no pid file found - php-fpm is not running ?" + exit 1 + fi + + kill -USR2 `cat $php_fpm_PID` + + echo " done" + ;; + + status) + + if [ -f "$php_fpm_PID" ]; then + echo "PHP-FPM is running." + else + echo "PHP-FPM is stopped." + fi + ;; + + logrotate) + + echo -n "Re-opening php-fpm log file " + + if [ ! -r $php_fpm_PID ] ; then + echo "warning, no pid file found - php-fpm is not running ?" + exit 1 + fi + + kill -USR1 `cat $php_fpm_PID` + + echo " done" + ;; + + *) + echo "Usage: /etc/init.d/php-fpm {start|stop|quit|restart|reload|status|logrotate}" + exit 1 + ;; + +esac + diff --git a/init.d/init.d.pureftpd b/init.d/init.d.pureftpd new file mode 100644 index 00000000..0b7e3fd3 --- /dev/null +++ b/init.d/init.d.pureftpd @@ -0,0 +1,81 @@ +#!/bin/bash +# +# chkconfig: 2345 85 15 +# description: Pure-FTPd is an FTP server daemon based upon Troll-FTPd +# processname: pure-ftpd + +### BEGIN INIT INFO +# Provides: pureftpd +# Required-Start: $all +# Required-Stop: $all +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: starts pureftpd server +# Description: starts pureftpd server +### END INIT INFO + +# Author: licess +# website: http://lnmp.org + +# Pure-FTPd Settings +PURE_PERL="/usr/local/pureftpd/sbin/pure-config.pl" +PURE_CONF="/usr/local/pureftpd/pure-ftpd.conf" +PURE_PID="/var/run/pure-ftpd.pid" +RETVAL=0 +prog="Pure-FTPd" + +start() { + echo -n $"Starting $prog... " + $PURE_PERL $PURE_CONF --daemonize + if [ "$?" = 0 ] ; then + echo " done" + else + echo " failed" + fi +} + +stop() { + echo -n $"Stopping $prog... " + if [ ! -e $PURE_PID ]; then + echo -n $"$prog is not running." + exit 1 + fi + kill `cat $PURE_PID` + if [ "$?" = 0 ] ; then + echo " done" + else + echo " failed" + fi +} + +restart(){ + echo $"Restarting $prog..." + $0 stop + sleep 2 + $0 start +} + +status(){ + if [ -e $PURE_PID ]; then + echo $"$prog is running." + else + echo $"$prog is not running." + fi +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + status) + status + ;; + *) + echo $"Usage: $0 {start|stop|restart}" +esac diff --git a/init.d/init.d.redis b/init.d/init.d.redis new file mode 100644 index 00000000..f4967dd4 --- /dev/null +++ b/init.d/init.d.redis @@ -0,0 +1,62 @@ +#! /bin/bash +# +# redis - this script starts and stops the redis-server daemon +# +# chkconfig: 2345 80 90 +# description: Redis is a persistent key-value database +# +### BEGIN INIT INFO +# Provides: redis +# Required-Start: $syslog +# Required-Stop: $syslog +# Should-Start: $local_fs +# Should-Stop: $local_fs +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: redis-server daemon +# Description: redis-server daemon +### END INIT INFO + +REDISPORT=6379 +EXEC=/usr/local/redis/bin/redis-server +REDIS_CLI=/usr/local/redis/bin/redis-cli + +PIDFILE=/var/run/redis.pid +CONF="/usr/local/redis/etc/redis.conf" + +case "$1" in + start) + if [ -f $PIDFILE ]; then + echo "$PIDFILE exists, process is already running or crashed" + else + echo -n "Starting Redis server..." + $EXEC $CONF + if [ "$?"="0" ]; then + echo " done" + else + echo " failed" + fi + fi + ;; + stop) + if [ ! -f $PIDFILE ]; then + echo "$PIDFILE does not exist, process is not running" + else + PID=$(cat $PIDFILE) + echo "Stopping Redis server..." + $REDIS_CLI -p $REDISPORT shutdown + if [ "$?"="0" ]; then + echo " done" + else + echo " failed" + fi + fi + ;; + restart) + ${0} stop + ${0} start + ;; + *) + echo "Usage: /etc/init.d/redis {start|stop|restart}" >&2 + exit 1 +esac \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 00000000..03c7cd7e --- /dev/null +++ b/install.sh @@ -0,0 +1,190 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script, please use root to install lnmp" + exit 1 +fi + +cur_dir=$(pwd) +Stack=$1 +if [ "${Stack}" = "" ]; then + Stack="lnmp" +else + Stack=$1 +fi + +LNMP_Ver='1.2' + +. include/main.sh +. include/init.sh +. include/mysql.sh +. include/mariadb.sh +. include/php.sh +. include/nginx.sh +. include/apache.sh +. include/end.sh + +Get_Dist_Name + +if [ "${DISTRO}" = "unknow" ]; then + Echo_Red "Unable to get Linux distribution name, or do NOT support the current distribution." + exit 1 +fi + +clear +echo "+------------------------------------------------------------------------+" +echo "| LNMP V${LNMP_Ver} for ${DISTRO} Linux Server, Written by Licess |" +echo "+------------------------------------------------------------------------+" +echo "| A tool to auto-compile & install LNMP/LNMPA/LAMP on Linux |" +echo "+------------------------------------------------------------------------+" +echo "| For more information please visit http://www.lnmp.org |" +echo "+------------------------------------------------------------------------+" + +Init_Install() +{ + Press_Install + Print_Sys_Info + if [ "${DISTRO}" = "RHEL" ]; then + RHEL_Modify_Source + fi + Get_Dist_Version + if [ "${DISTRO}" = "Ubuntu" ]; then + Ubuntu_Modify_Source + fi + Set_Timezone + if [ "$PM" = "yum" ]; then + CentOS_InstallNTP + CentOS_RemoveAMP + CentOS_Dependent + elif [ "$PM" = "apt" ]; then + Deb_InstallNTP + Xen_Hwcap_Setting + Deb_RemoveAMP + Deb_Dependent + fi + Disable_Selinux + Check_Download + Install_Autoconf + Install_Libiconv + Install_Libmcrypt + Install_Mhash + Install_Mcrypt + Install_Freetype + Install_Curl + Install_Pcre + if [ "${SelectMalloc}" = "2" ]; then + Install_Jemalloc + elif [ "${SelectMalloc}" = "3" ]; then + Install_TCMalloc + fi + if [ "$PM" = "yum" ]; then + CentOS_Lib_Opt + elif [ "$PM" = "apt" ]; then + Deb_Lib_Opt + Deb_Check_MySQL + fi + if [ "${DBSelect}" = "1" ]; then + Install_MySQL_51 + elif [ "${DBSelect}" = "2" ]; then + Install_MySQL_55 + elif [ "${DBSelect}" = "3" ]; then + Install_MySQL_56 + elif [ "${DBSelect}" = "4" ]; then + Install_MariaDB_5 + elif [ "${DBSelect}" = "5" ]; then + Install_MariaDB_10 + fi + Export_PHP_Autoconf +} + +LNMP_Stack() +{ + Init_Install + if [ "${PHPSelect}" = "1" ]; then + Install_PHP_52 + elif [ "${PHPSelect}" = "2" ]; then + Install_PHP_53 + elif [ "${PHPSelect}" = "3" ]; then + Install_PHP_54 + elif [ "${PHPSelect}" = "4" ]; then + Install_PHP_55 + elif [ "${PHPSelect}" = "5" ]; then + Install_PHP_56 + fi + Install_Nginx + Creat_PHP_Tools + Add_LNMP_Startup + Check_LNMP_Install +} + +LNMPA_Stack() +{ + Apache_Selection + Init_Install + if [ "${ApacheSelect}" = "1" ]; then + Install_Apache_22 + else + Install_Apache_24 + fi + if [ "${PHPSelect}" = "1" ]; then + Install_PHP_52 + elif [ "${PHPSelect}" = "2" ]; then + Install_PHP_53 + elif [ "${PHPSelect}" = "3" ]; then + Install_PHP_54 + elif [ "${PHPSelect}" = "4" ]; then + Install_PHP_55 + elif [ "${PHPSelect}" = "5" ]; then + Install_PHP_56 + fi + Install_Nginx + Creat_PHP_Tools + Add_LNMPA_Startup + Check_LNMPA_Install +} + +LAMP_Stack() +{ + Apache_Selection + Init_Install + if [ "${ApacheSelect}" = "1" ]; then + Install_Apache_22 + else + Install_Apache_24 + fi + if [ "${PHPSelect}" = "1" ]; then + Install_PHP_52 + elif [ "${PHPSelect}" = "2" ]; then + Install_PHP_53 + elif [ "${PHPSelect}" = "3" ]; then + Install_PHP_54 + elif [ "${PHPSelect}" = "4" ]; then + Install_PHP_55 + elif [ "${PHPSelect}" = "5" ]; then + Install_PHP_56 + fi + Creat_PHP_Tools + Add_LAMP_Startup + Check_LAMP_Install +} + +case "${Stack}" in + lnmp) + Dispaly_Selection + LNMP_Stack 2>&1 | tee -a /root/lnmp-install.log + ;; + lnmpa) + Dispaly_Selection + LNMPA_Stack 2>&1 | tee -a /root/lnmp-install.log + ;; + lamp) + Dispaly_Selection + LAMP_Stack 2>&1 | tee -a /root/lnmp-install.log + ;; + *) + Echo_Red "Usage: $0 {lnmp|lnmpa|lamp}" + ;; +esac \ No newline at end of file diff --git a/ionCube.sh b/ionCube.sh deleted file mode 100644 index ec1edd04..00000000 --- a/ionCube.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=======================================================================" -echo "Install ionCube for LNMP , Written by Licess " -echo "=======================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to install eAccelerator for lnmp " -echo "" -echo "For more information please visit http://www.lnmp.org " -echo "=======================================================================" -cur_dir=$(pwd) - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start install ionCube..." - char=`get_char` - -echo "=========================== install eaccelerator ======================" -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - cd /usr/local/ - wget -c http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz - tar zxvf ioncube_loaders_lin_x86-64.tar.gz -else - cd /usr/local/ - wget -c http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz - tar zxvf ioncube_loaders_lin_x86.tar.gz -fi - -sed -i '/ionCube Loader/d' /usr/local/php/etc/php.ini -sed -i '/ioncube_loader_lin/d' /usr/local/php/etc/php.ini - -cur_php_version=`/usr/local/php/bin/php -v` -if [[ "$cur_php_version" =~ "PHP 5.2." ]]; then - zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.2.so" -elif [[ "$cur_php_version" =~ "PHP 5.3." ]]; then - zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.3.so" -elif [[ "$cur_php_version" =~ "PHP 5.4." ]]; then - zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.4.so" -elif [[ "$cur_php_version" =~ "PHP 5.5." ]]; then - zend_ext="/usr/local/ioncube/ioncube_loader_lin_5.5.so" -fi - -cat >ionCube.ini< /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start install Memcached..." - char=`get_char` - -printf "=========================== install memcached ======================\n" - -if [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/memcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/memcache.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/memcache.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/memcache.so -fi - -cur_php_version=`/usr/local/php/bin/php -v` - -if echo "$cur_php_version" | grep -q "5.2." -then -sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/"\nextension = "memcache.so"\n#' /usr/local/php/etc/php.ini -elif echo "$cur_php_version" | grep -q "5.3." -then -sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/"\nextension = "memcache.so"\n#' /usr/local/php/etc/php.ini -elif echo "$cur_php_version" | grep -q "5.4." -then -sed -i 's#extension_dir = "./"#extension_dir = "/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/"\nextension = "memcache.so"\n#' /usr/local/php/etc/php.ini -else - echo "Error: can't get php version!" - echo "Maybe your php was didn't install or php configuration file has errors.Please check." - sleep 3 - exit 1 -fi - -echo "Install memcache php extension..." -wget -c http://soft.vpser.net/web/memcache/memcache-3.0.8.tgz -tar zxvf memcache-3.0.8.tgz -cd memcache-3.0.8/ -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make && make install -cd ../ - -wget -c http://soft.vpser.net/lib/libevent/libevent-2.0.13-stable.tar.gz -tar zxvf libevent-2.0.13-stable.tar.gz -cd libevent-2.0.13-stable/ -./configure --prefix=/usr/local/libevent -make&& make install -cd ../ - -echo "/usr/local/libevent/lib/" >> /etc/ld.so.conf -ln -s /usr/local/libevent/lib/libevent-2.0.so.5 /lib/libevent-2.0.so.5 -ldconfig - -cd $cur_dir -echo "Install memcached..." -wget -c http://soft.vpser.net/web/memcached/memcached-1.4.15.tar.gz -tar zxvf memcached-1.4.15.tar.gz -cd memcached-1.4.15/ -./configure --prefix=/usr/local/memcached -make &&make install -cd ../ - -ln /usr/local/memcached/bin/memcached /usr/bin/memcached - -cd $cur_dir -cp conf/memcached-init /etc/init.d/memcached -chmod +x /etc/init.d/memcached -useradd -s /sbin/nologin nobody - -if [ ! -d /var/lock/subsys ]; then - mkdir -p /var/lock/subsys -fi - -if [ -s /etc/debian_version ]; then -update-rc.d -f memcached defaults -elif [ -s /etc/redhat-release ]; then -chkconfig --level 345 memcached on -fi - -echo "Copy Memcached PHP Test file..." -cp conf/memcached.php /home/wwwroot/default/memcached.php - -if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then - echo "Restart Apache......" - /etc/init.d/httpd -k restart -else - echo "Restart php-fpm......" - /etc/init.d/php-fpm restart -fi - -echo "Starting Memcached..." -/etc/init.d/memcached start - -printf "===================== install Memcached completed =====================\n" -printf "Install Memcached completed,enjoy it!\n" -printf "You Can visit Memcached PHP Test file: http://ip/memcached.php\n" -printf "=======================================================================\n" -printf "Install Memcached for LNMP V1.0 , Written by Licess \n" -printf "=======================================================================\n" -printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" -printf "This script is a tool to install Memcached for lnmp \n" -printf "\n" -printf "For more information please visit http://www.lnmp.org \n" -printf "=======================================================================\n" \ No newline at end of file diff --git a/opcache.sh b/opcache.sh deleted file mode 100644 index 5d2fa2f2..00000000 --- a/opcache.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=======================================================================" -echo "Install Zend Opcache for LNMP , Written by Licess " -echo "=======================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to install Zend Opcache for lnmp " -echo "" -echo "For more information please visit http://www.lnmp.org " -echo "=======================================================================" -cur_dir=$(pwd) - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "=========================== install zend opcache ======================" - -if [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/opcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/opcache.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/opcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/opcache.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/opcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/opcache.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/opcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/opcache.so -fi - -cur_php_version=`/usr/local/php/bin/php -v` -if [[ "$cur_php_version" =~ "PHP 5.2." ]]; then - echo "Zend Opcache do NOT SUPPORT PHP 5.2.* and lower version of php 5.3" - sleep 1 - exit 1 -elif [[ "$cur_php_version" =~ "PHP 5.3." ]]; then - if echo $cur_php_version | grep -Eqi 'PHP 5.3.[234].';then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/opcache.so" - else - echo "If PHP under version 5.3.20, we do not recommend install opcache, it maybe cause 502 Bad Gateway error!" - sleep 3 - exit 1 - fi -elif [[ "$cur_php_version" =~ "PHP 5.4." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/opcache.so" -elif [[ "$cur_php_version" =~ "PHP 5.5." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/opcache.so" -else - echo "Error: can't get php version!" - echo "Maybe your php was didn't install or php configuration file has errors.Please check." - sleep 3 - exit 1 -fi - -if [ -s zendopcache-7.0.3 ]; then - rm -rf zendopcache-7.0.3/ -fi - -wget -c http://soft.vpser.net/web/opcache/zendopcache-7.0.3.tgz -tar zxf zendopcache-7.0.3.tgz -cd zendopcache-7.0.3/ -/usr/local/php/bin/phpize -./configure --with-php-config=/usr/local/php/bin/php-config -make -make install -cd ../ - -sed -i '/;opcache/,/;opcache end/d' /usr/local/php/etc/php.ini -cat >>/usr/local/php/etc/php.ini< /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "============================check files==================================" -if [ -s php-5.2.17.tar.gz ]; then - echo "php-5.2.17.tar.gz [found]" - else - echo "Error: php-5.2.17.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/php/php-5.2.17.tar.gz -fi +echo "==================================================" +echo "You will install PHP 5.2.17" +echo "==================================================" -if [ -s php-5.2.17-fpm-0.5.14.diff.gz ]; then - echo "php-5.2.17-fpm-0.5.14.diff.gz [found]" - else - echo "Error: php-5.2.17-fpm-0.5.14.diff.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/phpfpm/php-5.2.17-fpm-0.5.14.diff.gz -fi +Press_Start -if [ -s autoconf-2.13.tar.gz ]; then - echo "autoconf-2.13.tar.gz [found]" - else - echo "Error: autoconf-2.13.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/lib/autoconf/autoconf-2.13.tar.gz -fi -echo "============================check files==================================" - -echo "Stoping Nginx..." -/etc/init.d/nginx stop -echo "Stoping MySQL..." -/etc/init.d/mysql stop -echo "Stoping PHP-FPM..." -/etc/init.d/php-fpm stop -if [ -s /etc/init.d/memceached ]; then - echo "Stoping Memcached..." - /etc/init.d/memcacehd stop -fi +cd ${cur_dir}/src +Download_Files http://soft.vpser.net/web/php/php-5.2.17.tar.gz php-5.2.17.tar.gz +Download_Files http://soft.vpser.net/web/phpfpm/php-5.2.17-fpm-0.5.14.diff.gz php-5.2.17-fpm-0.5.14.diff.gz -rm -rf php-5.2.17/ +lnmp stop -tar zxvf autoconf-2.13.tar.gz -cd autoconf-2.13/ -./configure --prefix=/usr/local/autoconf-2.13 -make && make install -cd ../ +if [[ -s /usr/local/autoconf-2.13/bin/autoconf && -s /usr/local/autoconf-2.13/bin/autoheader ]]; then + Echo_Green "Autconf 2.13...ok" +else + Install_Autoconf +fi + +if [[ -s /usr/local/curl/bin/curl ]]; then + Echo_Green "Curl...ok" +else + Install_Curl +fi ln -s /usr/lib/libevent-1.4.so.2 /usr/local/lib/libevent-1.4.so.2 ln -s /usr/lib/libltdl.so /usr/lib/libltdl.so.3 -cd $cur_dir +cd ${cur_dir}/src +rm -rf php-5.2.17 echo "Start install php-5.2.17....." -export PHP_AUTOCONF=/usr/local/autoconf-2.13/bin/autoconf -export PHP_AUTOHEADER=/usr/local/autoconf-2.13/bin/autoheader -tar zxvf php-5.2.17.tar.gz +Export_PHP_Autoconf +tar zxf php-5.2.17.tar.gz gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1 cd php-5.2.17/ -wget -c http://soft.vpser.net/web/php/bug/php-5.2.17-max-input-vars.patch -patch -p1 < php-5.2.17-max-input-vars.patch +patch -p1 < $cur_dir/src/patch/php-5.2.17-max-input-vars.patch +patch -p0 < $cur_dir/src/patch/php-5.2.17-xml.patch +patch -p1 < $cur_dir/src/patch/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch ./buildconf --force -if [ "$ismysql" = "no" ]; then - ./configure --prefix=/usr/local/php52 --with-config-file-path=/usr/local/php52/etc --with-mysql=/usr/local/mariadb --with-mysqli=/usr/local/mariadb/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic -else - ./configure --prefix=/usr/local/php52 --with-config-file-path=/usr/local/php52/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic -fi -if cat /etc/issue | grep -Eqi '(Debian|Ubuntu)';then - cd ext/openssl/ - wget -c http://soft.vpser.net/lnmp/ext/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch - patch -p3 >/usr/local/php52/etc/php.ini<>/usr/local/php52/etc/php.ini<&1 | tee installphp5.2.17.log to record install logs." +Echo_Red "Failed to install PHP 5.2.17!,you need try to run ./php5.2.17.sh 2>&1 | tee installphp5.2.17.log to record install logs." fi \ No newline at end of file diff --git a/proftpd.sh b/proftpd.sh deleted file mode 100644 index c43322a9..00000000 --- a/proftpd.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - printf "Error: You must be root to run this script!\n" - exit 1 -fi -clear -printf "=========================================================================\n" -printf "Proftpd for LNMP V1.0 , Written by Licess \n" -printf "=========================================================================\n" -printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" -printf "This script is a tool to install Proftpd for lnmp \n" -printf "\n" -printf "For more information please visit http://www.lnmp.org \n" -printf "\n" -printf "Usage: ./proftpd.sh \n" -printf "=========================================================================\n" -cur_dir=$(pwd) - - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start install ProFTPd..." - char=`get_char` - -echo "Install building packages..." -cat /etc/issue | grep -Eqi '(Debian|Ubuntu)' && apt-get update;apt-get install build-essential gcc g++ make -y || yum -y install make gcc gcc-c++ gcc-g77 - -echo "Start download files..." -wget -c ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.4b.tar.gz -tar zxf proftpd-1.3.4b.tar.gz -cd proftpd-1.3.4b -./configure --prefix=/usr/local/proftpd -make && make install -cd ../ - -ln -s /usr/local/proftpd/sbin/proftpd /usr/local/bin/ -ln -s /usr/local/proftpd/bin/ftpasswd /usr/local/bin/ - -mkdir /usr/local/proftpd/var/log/ -mkdir /usr/local/proftpd/etc/vhost/ - -cat >/usr/local/proftpd/etc/proftpd.conf< - DenyAll - -SystemLog /usr/local/proftpd/var/log/proftpd.log -Include /usr/local/proftpd/etc/vhost/*.conf -EOF - -wget -c http://soft.vpser.net/lnmp/ext/init.d.proftpd -cp init.d.proftpd /etc/init.d/proftpd -chmod +x /etc/init.d/proftpd - -cat /etc/issue | grep -Eqi '(Debian|Ubuntu)' && update-rc.d -f proftpd defaults;ln -s /usr/sbin/nologin /sbin/nologin || chkconfig --level 345 proftpd on - -if [ -s /sbin/iptables ]; then -/sbin/iptables -I INPUT -p tcp --dport 21 -j ACCEPT -/sbin/iptables -I INPUT -p tcp --dport 20 -j ACCEPT -/sbin/iptables -I INPUT -p tcp --dport 20000:30000 -j ACCEPT -/sbin/iptables-save -fi - -cp proftpd_vhost.sh /root/proftpd_vhost.sh - -clear -printf "=======================================================================\n" -printf "Starting proftpd...\n" -/etc/init.d/proftpd start -printf "=======================================================================\n" -printf "Install ProFTPd completed,enjoy it!\n" -printf "=======================================================================\n" -printf "Install ProFTPd for LNMP V1.0 , Written by Licess \n" -printf "=======================================================================\n" -printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" -printf "This script is a tool to install ProFTPd for lnmp \n" -printf "\n" -printf "For more information please visit http://www.lnmp.org \n" -printf "=======================================================================\n" diff --git a/proftpd_vhost.sh b/proftpd_vhost.sh deleted file mode 100644 index f78a76ab..00000000 --- a/proftpd_vhost.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, use sudo sh $0" - exit 1 -fi - -clear -echo "=========================================================================" -echo "Add ProFTPd Virtual Host for LNMP v1.0 , Written by Licess " -echo "=========================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to add virtual host for nginx " -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" - - username="" - read -p "Please input a username:" username - if [ "$username" = "" ]; then - echo "UserName can't be NULL!" - sleep 2 - exit 1 - fi - - if cat /etc/passwd | awk -F : '{print $1}' | grep $username >/dev/null 2>&1 - then - echo "User: $username is exist!" - echo "Please rerun this script,input a new username!" - sleep 5 - exit 1 - else - echo "User $username will add to your system." - fi - - userpass="" - echo "Please set password for $username:" - read userpass - - if [ "$userpass" == "" ]; then - - echo "Password can't be NULL!" - sleep 2 - exit 1 - else - echo "Password: $userpass" - fi - - userdir="" - echo "Please set the directory of $username" - read -p "Please input full path:" userdir - - if [ "$userdir" == "" ]; then - - echo "Directory can't be NULL!" - sleep 2 - exit 1 - else - echo "Directory: $userdir" - fi - - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start create ProFTPd virtul host..." - char=`get_char` - - -if [ ! -d /usr/local/proftpd/etc/vhost ]; then - mkdir /usr/local/proftpd/etc/vhost -fi - -if [ ! -d $userdir ]; then - echo "Create Virtul Host directory......" - mkdir $userdir -fi - -useradd -s /sbin/nologin -d $userdir -c "lnmp proftpd user" $username -cat >/tmp/$user.passwd</usr/local/proftpd/etc/vhost/$username.conf< - - AllowUser $username - -
-eof - -echo "Restart ProFTPd......" -/etc/init.d/proftpd stop -/etc/init.d/proftpd start - -echo "=========================================================================" -echo "Add ProFTPd Virtual Host for LNMP v1.0 , Written by Licess " -echo "=========================================================================" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "Your UserName:$username" -echo "Your Password:$userpass" -echo "Directory of $username:$userdir" -echo "" -echo "=========================================================================" \ No newline at end of file diff --git a/pureftpd.sh b/pureftpd.sh index 9e26d50d..1a99d582 100644 --- a/pureftpd.sh +++ b/pureftpd.sh @@ -4,182 +4,164 @@ export PATH # Check if user is root if [ $(id -u) != "0" ]; then - printf "Error: You must be root to run this script!\n" + echo "Error: You must be root to run this script!" exit 1 fi clear -printf "=========================================================================\n" -printf "Pureftpd for LNMP, Written by Licess \n" -printf "=========================================================================\n" -printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" -printf "This script is a tool to install pureftpd for lnmp \n" -printf "\n" -printf "For more information please visit http://www.lnmp.org \n" -printf "\n" -printf "Usage: ./pureftpd.sh \n" -printf "=========================================================================\n" +echo "+----------------------------------------------------------+" +echo "| Pureftpd for LNMP, Written by Licess |" +echo "+----------------------------------------------------------+" +echo "|This script is a tool to install pureftpd for LNMP |" +echo "+----------------------------------------------------------+" +echo "|For more information please visit http://www.lnmp.org |" +echo "+----------------------------------------------------------+" +echo "|Usage: ./pureftpd.sh |" +echo "+----------------------------------------------------------+" cur_dir=$(pwd) - -if [ -s /usr/local/mariadb/bin/mysql ]; then - ismysql="no" -else - ismysql="yes" -fi -#set mysql root password - - mysqlrootpwd="" - read -p "Please input your root password of mysql:" mysqlrootpwd - if [ "$mysqlrootpwd" = "" ]; then - echo "MySQL root password can't be NULL!" - exit 1 - else - echo "===========================" - echo "Your root password of mysql was:$mysqlrootpwd" - echo "===========================" - fi +action=$1 +. include/main.sh +. include/init.sh + +Get_OS_Bit +Get_Dist_Name +Check_DB + +Check_Pureftpd() +{ + if [ ! -f /usr/local/pureftpd/sbin/pure-config.pl ]; then + echo "Pureftpd was not installed!" + exit 1 + fi +} + +Install_Pureftpd() +{ + Verify_DB_Password #set password of User manager - ftpmanagerpwd="" - read -p "Please input password of User manager:" ftpmanagerpwd - if [ "$ftpmanagerpwd" = "" ]; then - echo "password of User manager can't be NULL!" - exit 1 - else - echo "===========================" - echo "Your password of User manager was:$ftpmanagerpwd" - echo "===========================" - fi + Ftp_Manager_Pwd="" + read -p "Please enter password of User manager: " Ftp_Manager_Pwd + if [ "${Ftp_Manager_Pwd}" = "" ]; then + echo "password of User manager can't be NULL!" + exit 1 + else + echo "==================================================" + echo "Your password of User manager:${Ftp_Manager_Pwd}" + echo "==================================================" + fi #set password of mysql ftp user - mysqlftppwd="" - read -p "Please input password of mysql ftp user:" mysqlftppwd - if [ "$mysqlftppwd" = "" ]; then - echo "password of User manager can't be NULL!" - echo "script will randomly generated a password!" - mysqlftppwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` - echo "===========================" - echo "Your password of mysql ftp user was:$mysqlftppwd" - echo "===========================" - fi - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start install Pure-FTPd..." - char=`get_char` - -echo "Start download files..." -wget -c http://soft.vpser.net/ftp/pure-ftpd/pure-ftpd-1.0.36.tar.gz -wget -c http://soft.vpser.net/ftp/pure-ftpd/User_manager_for-PureFTPd_v2.1_CN.zip - -if [ "$ismysql" = "no" ]; then - \cp /usr/local/mariadb/lib/* /usr/lib/ -elif [ "$ismysql" = "yes" ]; then - mysql_version=`/usr/local/mysql/bin/mysql -V | awk '{print $5}' | tr -d ","` - if [[ "$mysql_version" =~ "5.1." ]]; then - \cp /usr/local/mysql/lib/mysql/*.* /usr/lib/ - else - \cp /usr/local/mysql/lib/* /usr/lib/ - fi -fi - -if [ -s /var/lib/mysql/mysql.sock ]; then -rm -f /var/lib/mysql/mysql.sock -fi -mkdir /var/lib/mysql -ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock - -echo "Start install pure-ftpd..." -tar zxvf pure-ftpd-1.0.36.tar.gz -cd pure-ftpd-1.0.36/ -if [ "$ismysql" = "no" ]; then - ./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mariadb --with-quotas --with-cookie --with-virtualhosts --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 -else - ./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=/usr/local/mysql --with-quotas --with-cookie --with-virtualhosts --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 -fi - -make && make install - -echo "Copy configure files..." -cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/ -chmod 755 /usr/local/pureftpd/sbin/pure-config.pl -cp $cur_dir/conf/pureftpd-mysql.conf /usr/local/pureftpd/ -cp $cur_dir/conf/pure-ftpd.conf /usr/local/pureftpd/ - -echo "Modify parameters of pureftpd configures..." -sed -i 's/127.0.0.1/localhost/g' /usr/local/pureftpd/pureftpd-mysql.conf -sed -i 's/tmppasswd/'$mysqlftppwd'/g' /usr/local/pureftpd/pureftpd-mysql.conf -cp $cur_dir/conf/script.mysql /tmp/script.mysql -sed -i 's/mysqlftppwd/'$mysqlftppwd'/g' /tmp/script.mysql -sed -i 's/ftpmanagerpwd/'$ftpmanagerpwd'/g' /tmp/script.mysql - -echo "Import pureftpd database..." -if [ "$ismysql" = "no" ]; then - /usr/local/mariadb/bin/mysql -u root -p$mysqlrootpwd -h localhost < /tmp/script.mysql -elif [ "$ismysql" = "yes" ]; then - /usr/local/mysql/bin/mysql -u root -p$mysqlrootpwd -h localhost < /tmp/script.mysql + Ftp_DB_Pwd="" + read -p "Please enter password of mysql ftp user: " Ftp_DB_Pwd + if [ "${Ftp_DB_Pwd}" = "" ]; then + echo "password of User manager can't be NULL." + echo "script will randomly generated a password." + Ftp_DB_Pwd=`cat /dev/urandom | head -1 | md5sum | head -c 8` + echo "================================================" + echo "Your password of mysql ftp user:${Ftp_DB_Pwd}" + echo "================================================" + fi + + Press_Install + + echo "Download files..." + cd ${cur_dir}/src + Download_Files ${Download_Mirror}/ftp/pure-ftpd/${Pureftpd_Ver}.tar.gz ${Pureftpd_Ver}.tar.gz + Download_Files ${Download_Mirror}/ftp/pure-ftpd/${Pureftpd_Manager_Ver}.zip ${Pureftpd_Manager_Ver}.zip + + if [ -s /var/lib/mysql/mysql.sock ]; then + ln -sf /tmp/mysql.sock /var/lib/mysql/mysql.sock + fi + + echo "Installing pure-ftpd..." + Tar_Cd ${Pureftpd_Ver}.tar.gz ${Pureftpd_Ver} + ./configure --prefix=/usr/local/pureftpd CFLAGS=-O2 --with-mysql=${MySQL_Dir} --with-quotas --with-cookie --with-virtualhosts --with-diraliases --with-sysquotas --with-ratios --with-altlog --with-paranoidmsg --with-shadow --with-welcomemsg --with-throttling --with-uploadscript --with-language=english --with-rfc2640 + + make && make install + + echo "Copy configure files..." + \cp configuration-file/pure-config.pl /usr/local/pureftpd/sbin/ + chmod 755 /usr/local/pureftpd/sbin/pure-config.pl + \cp $cur_dir/conf/pureftpd-mysql.conf /usr/local/pureftpd/ + \cp $cur_dir/conf/pure-ftpd.conf /usr/local/pureftpd/ + + echo "Modify parameters of pureftpd configures..." + sed -i 's/127.0.0.1/localhost/g' /usr/local/pureftpd/pureftpd-mysql.conf + sed -i 's/Ftp_DB_Pwd/'${Ftp_DB_Pwd}'/g' /usr/local/pureftpd/pureftpd-mysql.conf + \cp $cur_dir/conf/pureftpd-script.sql /tmp/pureftpd-script.sql + sed -i 's/Ftp_DB_Pwd/'${Ftp_DB_Pwd}'/g' /tmp/pureftpd-script.sql + sed -i 's/Ftp_Manager_Pwd/'${Ftp_Manager_Pwd}'/g' /tmp/pureftpd-script.sql + + echo "Import pureftpd database..." + ${MySQL_Bin} -u root -p${DB_Root_Password} -h localhost < /tmp/pureftpd-script.sql + Is_SQL_Import=$? + + echo "Installing GUI User manager for PureFTPd..." + cd ${cur_dir}/src + unzip -q ${Pureftpd_Manager_Ver}.zip + mv ftp /home/wwwroot/default/ + chmod 777 -R /home/wwwroot/default/ftp/ + chown www -R /home/wwwroot/default/ftp/ + + echo "Modify parameters of GUI User manager for PureFTPd..." + www_uid=`id -u www` + www_gid=`id -g www` + sed -i 's/\$DEFUserID.*/\$DEFUserID = "'${www_uid}'";/g' /home/wwwroot/default/ftp/config.php + sed -i 's/\$DEFGroupID.*/\$DEFGroupID = "'${www_gid}'";/g' /home/wwwroot/default/ftp/config.php + sed -i 's/English/Chinese/g' /home/wwwroot/default/ftp/config.php + sed -i 's/tmppasswd/'${Ftp_DB_Pwd}'/g' /home/wwwroot/default/ftp/config.php + sed -i 's/127.0.0.1/localhost/g' /home/wwwroot/default/ftp/config.php + sed -i 's/myipaddress.com/localhost/g' /home/wwwroot/default/ftp/config.php + mv /home/wwwroot/default/ftp/install.php /home/wwwroot/default/ftp/install.php.bak + rm -f /tmp/pureftpd-script.sql + + \cp $cur_dir/init.d/init.d.pureftpd /etc/init.d/pureftpd + chmod +x /etc/init.d/pureftpd + + StartUp pureftpd + + if [ -s /sbin/iptables ]; then + /sbin/iptables -I INPUT -p tcp --dport 21 -j ACCEPT + /sbin/iptables -I INPUT -p tcp --dport 20 -j ACCEPT + /sbin/iptables -I INPUT -p tcp --dport 20000:30000 -j ACCEPT + /sbin/iptables-save + fi + + if [[ -s /usr/local/pureftpd/sbin/pure-config.pl && -s /usr/local/pureftpd/pure-ftpd.conf && -s /etc/init.d/pureftpd && ${Is_SQL_Import} -eq 0 ]]; then + echo "Starting pureftpd..." + /etc/init.d/pureftpd start + echo "+----------------------------------------------------------------------+" + echo "| Install Pure-FTPd completed,enjoy it!" + echo "| =>Now you enter http://IP/ftp/ in you Web Browser to manage FTP users." + echo "| =>Or use command: lnmp ftp {add|list|del} to manage FTP users." + echo "| =>password of User manager was:${Ftp_Manager_Pwd}" + echo "| =>password of mysql ftp user was:${Ftp_DB_Pwd}" + echo "+----------------------------------------------------------------------+" + echo "| For more information please visit http://www.lnmp.org" + echo "+----------------------------------------------------------------------+" + else + Echo_Red "Pureftpd install failed!" + fi +} + +Uninstall_Pureftpd() +{ + Check_Pureftpd + echo "Stop pureftpd..." + /etc/init.d/pureftpd stop + echo "Remove service..." + Remove_StartUp pureftpd + echo "Delete files..." + rm -f /etc/init.d/pureftpd + rm -rf /usr/local/pureftpd + rm -rf /home/wwwroot/default/ftp + echo "Pureftpd uninstall completed." +} + +if [ "${action}" == "uninstall" ]; then + Uninstall_Pureftpd else - echo "MySQL or MariaDB NOT FOUND!Please check." - exit 1 -fi - -rm -f /tmp/script.mysql - -echo "Install GUI User manager for PureFTPd..." -cd $cur_dir -unzip User_manager_for-PureFTPd_v2.1_CN.zip -mv ftp /home/wwwroot/default/ -chmod 777 -R /home/wwwroot/default/ftp/ -chown www -R /home/wwwroot/default/ftp/ - -echo "Modify parameters of GUI User manager for PureFTPd..." -sed -i 's/English/Chinese/g' /home/wwwroot/default/ftp/config.php -sed -i 's/tmppasswd/'$mysqlftppwd'/g' /home/wwwroot/default/ftp/config.php -sed -i 's/127.0.0.1/localhost/g' /home/wwwroot/default/ftp/config.php -sed -i 's/myipaddress.com/localhost/g' /home/wwwroot/default/ftp/config.php -mv /home/wwwroot/default/ftp/install.php /home/wwwroot/default/ftp/install.php.bak - -wget -c http://soft.vpser.net/lnmp/ext/init.d.pureftpd -cp init.d.pureftpd /etc/init.d/pureftpd -chmod +x /etc/init.d/pureftpd - -if [ -s /etc/debian_version ]; then -update-rc.d pureftpd defaults -elif [ -s /etc/redhat-release ]; then -chkconfig --level 345 pureftpd on -fi - -if [ -s /sbin/iptables ]; then -/sbin/iptables -I INPUT -p tcp --dport 21 -j ACCEPT -/sbin/iptables -I INPUT -p tcp --dport 20 -j ACCEPT -/sbin/iptables -I INPUT -p tcp --dport 20000:30000 -j ACCEPT -/sbin/iptables-save -fi - -clear -printf "=======================================================================\n" -printf "Starting pureftpd...\n" -/etc/init.d/pureftpd start -printf "=======================================================================\n" -printf "Install Pure-FTPd completed,enjoy it!\n" -printf "Now you enter http://youdomain.com/ftp/ in you Web Browser to manager FTP users\n" -printf "Your password of User manager was:$ftpmanagerpwd\n" -printf "Your password of mysql ftp user was:$mysqlftppwd\n" -printf "=======================================================================\n" -printf "Install Pure-FTPd for LNMP, Written by Licess \n" -printf "=======================================================================\n" -printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" -printf "This script is a tool to install Pure-FTPd for lnmp \n" -printf "\n" -printf "For more information please visit http://www.lnmp.org \n" -printf "=======================================================================\n" + Install_Pureftpd 2>&1 | tee /root/pureftpd-install.log +fi \ No newline at end of file diff --git a/redis.sh b/redis.sh deleted file mode 100644 index 11f451d4..00000000 --- a/redis.sh +++ /dev/null @@ -1,187 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=======================================================================" -echo "Install Redis for LNMP , Written by Licess " -echo "=======================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to install Redis for lnmp " -echo "" -echo "For more information please visit http://www.lnmp.org " -echo "=======================================================================" -cur_dir=$(pwd) - - ver="old" - echo "Which version do you want to install:" - echo "Install Redis 2.8.8 Stable Version please type: s" - echo "Install Redis 3.0.0 Beta Version please type: b" - echo "Install Redis 2.6.17 Old Version please type: o" - read -p "Type s, b or o (Default Stable version):" ver - if [ "$ver" = "" ]; then - ver="s" - fi - - if [ "$ver" = "s" ]; then - echo "You will install Redis 2.8.8 Stable Version" - elif [ "$ver" = "b" ]; then - echo "You will install Redis 3.0.0 Beta Version" - elif [ "$ver" = "o" ]; then - echo "You will install Redis 2.6.17 Old Version" - else - echo "Input error,please input s, b or o !" - echo "Please Rerun $0" - exit 1 - fi - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "=========================== install Redis ======================" - -#Install Redis Stable Version -function install_stable { -if [ -s redis-2.8.8 ]; then - rm -rf redis-2.8.8/ -fi - -wget -c http://download.redis.io/releases/redis-2.8.8.tar.gz -tar zxf redis-2.8.8.tar.gz -cd redis-2.8.8/ -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - make PREFIX=/usr/local/redis install -else - make CFLAGS="-march=i686" PREFIX=/usr/local/redis install -fi -mkdir -p /usr/local/redis/etc/ -cp redis.conf /usr/local/redis/etc/ -sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/etc/redis.conf -cd ../ -} - -#Install Redis Beta Version -function install_beta { -if [ -s redis-3.0.0-beta2 ]; then -rm -rf redis-3.0.0-beta2/ -fi - - -wget -c --no-check-certificate https://github.com/antirez/redis/archive/3.0.0-beta2.tar.gz -O redis-3.0.0-beta2.tar.gz -tar zxf redis-3.0.0-beta2.tar.gz -cd redis-3.0.0-beta2/ -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - make PREFIX=/usr/local/redis install -else - make CFLAGS="-march=i686" PREFIX=/usr/local/redis install -fi -mkdir -p /usr/local/redis/etc/ -cp redis.conf /usr/local/redis/etc/ -sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/etc/redis.conf -cd ../ -} - -#Install Redis old Version -function install_old { -if [ -s redis-2.6.17 ]; then -rm -rf redis-2.6.17/ -fi - -wget -c http://download.redis.io/releases/redis-2.6.17.tar.gz -tar zxf redis-2.6.17.tar.gz -cd redis-2.6.17/ -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - make PREFIX=/usr/local/redis install -else - make CFLAGS="-march=i686" PREFIX=/usr/local/redis install -fi -mkdir -p /usr/local/redis/etc/ -cp redis.conf /usr/local/redis/etc/ -sed -i 's/daemonize no/daemonize yes/g' /usr/local/redis/etc/redis.conf -cd ../ -} - -function phpredis { -<<<<<<< HEAD - if [ -s redis-2.2.5 ]; then - rm -rf redis-2.2.5/ - fi - sed -i '/redis.so/d' /usr/local/php/etc/php.ini -======= ->>>>>>> 1b62bc6cfabbe74c33509128dd97d5863642005e - wget -c http://pecl.php.net/get/redis-2.2.5.tgz - tar zxf redis-2.2.5.tgz - cd redis-2.2.5/ - /usr/local/php/bin/phpize - ./configure --with-php-config=/usr/local/php/bin/php-config - make && make install - cd ../ -<<<<<<< HEAD -sed -i '/the dl()/i\ -extension = "redis.so"' /usr/local/php/etc/php.ini -} - -function startall { -======= - sed -i '/the dl()/i\ - extension = "redis.so"' /usr/local/php/etc/php.ini -} - -function start { ->>>>>>> 1b62bc6cfabbe74c33509128dd97d5863642005e - rm -f /etc/init.d/redis - wget -c http://soft.vpser.net/lnmp/ext/init.d.redis -O /etc/init.d/redis - chmod +x /etc/init.d/redis - echo "Add to auto start..." - if [ -s /etc/debian_version ]; then - update-rc.d -f redis defaults - elif [ -s /etc/redhat-release ]; then - chkconfig --level 345 redis on - fi - if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then - echo "Restarting Apache......" - /etc/init.d/httpd restart - else - echo "Restarting php-fpm......" - /etc/init.d/php-fpm restart - fi - /etc/init.d/redis start -} - -if [ "$ver" = "s" ]; then - install_stable -elif [ "$ver" = "b" ]; then - install_beta -else - install_old -fi -phpredis -startall - -echo "===================== install Redis completed ===================" -echo "Install Redis completed,enjoy it!" -echo "=======================================================================" -echo "Install Redis for LNMP , Written by Licess " -echo "=======================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to install Redis for lnmp " -echo "" -echo "For more information please visit http://www.lnmp.org " -echo "=======================================================================" \ No newline at end of file diff --git a/remove_disable_function.sh b/remove_disable_function.sh deleted file mode 100644 index b9670d14..00000000 --- a/remove_disable_function.sh +++ /dev/null @@ -1,94 +0,0 @@ - #!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -printf "=======================================================================\n" -printf "Remove php disable functions for LNMP V1.0 , Written by Licess \n" -printf "=======================================================================\n" -printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" -printf "This script is a tool to remove php disable functions for lnmp \n" -printf "\n" -printf "more information please visit http://www.lnmp.org \n" -printf "=======================================================================\n" -cur_dir=$(pwd) - - ver="" - echo "Remove all php disable function please type: 1" - echo "Only remove scandir function please type: 2" - echo "Only remove exec function please type: 3" - read -p "Please input 1 2 or 3:" ver - if [ "$ver" = "" ]; then - ver="1" - fi - - if [ "$ver" = "1" ]; then - echo "You will remove all php disable functions." - elif [ "$ver" = "2" ]; then - echo "You will remove scandir php disable function." - elif [ "$ver" = "3" ]; then - echo "You will remove exec php disable_function." - fi - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - - -function remove_all_disable_function() -{ - sed -i 's/disable_functions =.*/disable_functions =/g' /usr/local/php/etc/php.ini -} - -function remove_scandir_function() -{ - sed -i 's/,scandir//g' /usr/local/php/etc/php.ini -} - -function remove_exec_function() -{ - sed -i 's/,exec//g' /usr/local/php/etc/php.ini -} - -if [ "$ver" = "1" ]; then - remove_all_disable_function -elif [ "$ver" = "2" ]; then - remove_scandir_function -elif [ "$ver" = "3" ]; then - remove_exec_function -fi - -if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then -echo "Restarting Apache......" -/etc/init.d/httpd -k restart -else -echo "Restarting php-fpm......" -/etc/init.d/php-fpm restart -fi - -printf "=======================================================================\n" -printf "Remove php disable funtion completed,enjoy it!\n" -printf "=======================================================================\n" -printf "Remove php disable functions for LNMP V1.0 , Written by Licess \n" -printf "=======================================================================\n" -printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" -printf "This script is a tool to remove php disable functions for lnmp \n" -printf "\n" -printf "For more information please visit http://www.lnmp.org \n" -printf "=======================================================================\n" \ No newline at end of file diff --git a/reset_mysql_root_password.sh b/reset_mysql_root_password.sh deleted file mode 100644 index b9d7b98a..00000000 --- a/reset_mysql_root_password.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script!" - exit 1 -fi - -echo "=========================================================================" -echo "Reset MySQL/MariaDB root Password for LNMP , Written by Licess " -echo "=========================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to reset mysql/mariadb root password for lnmp " -echo "For more information please visit http://www.lnmp.org " -echo "" -echo "Usage: bash reset_mysql_root_password.sh" -echo "=========================================================================" - -if [ -s /usr/local/mariadb/bin/mysql ]; then - M_Name="mariadb" -else - M_Name="mysql" -fi - -mysql_root_password="" -read -p "(Please input New MySQL root password):" mysql_root_password -if [ "$mysql_root_password" = "" ]; then - echo "Error: Password can't be NULL!!" - exit 1 -fi - -echo "Stoping MySQL..." -/etc/init.d/$M_Name stop -echo "Starting MySQL with skip grant tables" -/usr/local/$M_Name/bin/mysqld_safe --skip-grant-tables >/dev/null 2>&1 & -echo "using mysql to flush privileges and reset password" -sleep 5 -echo "update user set password = Password('$mysql_root_password') where User = 'root'" -/usr/local/$M_Name/bin/mysql -u root mysql << EOF -update user set password = Password('$mysql_root_password') where User = 'root'; -EOF - -reset_status=`echo $?` -if [ $reset_status = "0" ]; then -echo "Password reset succesfully. Now killing mysqld softly" -killall mysqld -sleep 5 -echo "Restarting the actual mysql service" -/etc/init.d/$M_Name start -echo "Password successfully reset to '$mysql_root_password'" -else -echo "Reset MySQL root password failed!" -fi \ No newline at end of file diff --git a/src/patch/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch b/src/patch/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch new file mode 100644 index 00000000..b935dbb3 --- /dev/null +++ b/src/patch/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch @@ -0,0 +1,52 @@ +--- a/ext/openssl/xp_ssl.c ++++ b/ext/openssl/xp_ssl.c +@@ -328,10 +328,12 @@ static inline int php_openssl_setup_cryp + sslsock->is_client = 1; + method = SSLv23_client_method(); + break; ++#ifndef OPENSSL_NO_SSL2 + case STREAM_CRYPTO_METHOD_SSLv2_CLIENT: + sslsock->is_client = 1; + method = SSLv2_client_method(); + break; ++#endif + case STREAM_CRYPTO_METHOD_SSLv3_CLIENT: + sslsock->is_client = 1; + method = SSLv3_client_method(); +@@ -348,10 +350,12 @@ static inline int php_openssl_setup_cryp + sslsock->is_client = 0; + method = SSLv3_server_method(); + break; ++#ifndef OPENSSL_NO_SSL2 + case STREAM_CRYPTO_METHOD_SSLv2_SERVER: + sslsock->is_client = 0; + method = SSLv2_server_method(); + break; ++#endif + case STREAM_CRYPTO_METHOD_TLS_SERVER: + sslsock->is_client = 0; + method = TLSv1_server_method(); +@@ -629,9 +633,11 @@ static inline int php_openssl_tcp_sockop + case STREAM_CRYPTO_METHOD_SSLv23_CLIENT: + sock->method = STREAM_CRYPTO_METHOD_SSLv23_SERVER; + break; ++#ifndef OPENSSL_NO_SSL2 + case STREAM_CRYPTO_METHOD_SSLv2_CLIENT: + sock->method = STREAM_CRYPTO_METHOD_SSLv2_SERVER; + break; ++#endif + case STREAM_CRYPTO_METHOD_SSLv3_CLIENT: + sock->method = STREAM_CRYPTO_METHOD_SSLv3_SERVER; + break; +@@ -911,9 +917,11 @@ php_stream *php_openssl_ssl_socket_facto + if (strncmp(proto, "ssl", protolen) == 0) { + sslsock->enable_on_connect = 1; + sslsock->method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT; ++#ifndef OPENSSL_NO_SSL2 + } else if (strncmp(proto, "sslv2", protolen) == 0) { + sslsock->enable_on_connect = 1; + sslsock->method = STREAM_CRYPTO_METHOD_SSLv2_CLIENT; ++#endif + } else if (strncmp(proto, "sslv3", protolen) == 0) { + sslsock->enable_on_connect = 1; + sslsock->method = STREAM_CRYPTO_METHOD_SSLv3_CLIENT; diff --git a/src/patch/libiconv-glibc-2.16.patch b/src/patch/libiconv-glibc-2.16.patch new file mode 100644 index 00000000..169f5cb3 --- /dev/null +++ b/src/patch/libiconv-glibc-2.16.patch @@ -0,0 +1,13 @@ +--- srclib/stdio.in.h.orig 2011-08-07 16:42:06.000000000 +0300 ++++ srclib/stdio.in.h 2013-01-10 15:53:03.000000000 +0200 +@@ -695,7 +695,9 @@ + /* It is very rare that the developer ever has full control of stdin, + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); ++#if defined(__GLIBC__) && !defined(__UCLIBC__) && !__GLIBC_PREREQ(2, 16) ++ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); ++#endif + #endif + + diff --git a/src/patch/mod_remoteip.c b/src/patch/mod_remoteip.c new file mode 100644 index 00000000..f58098dc --- /dev/null +++ b/src/patch/mod_remoteip.c @@ -0,0 +1,447 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ap_config.h" +#include "ap_mmn.h" +#include "httpd.h" +#include "http_config.h" +#include "http_connection.h" +#include "http_protocol.h" +#include "http_log.h" +#include "apr_strings.h" +#include "apr_lib.h" +#define APR_WANT_BYTEFUNC +#include "apr_want.h" +#include "apr_network_io.h" + +module AP_MODULE_DECLARE_DATA remoteip_module; + +typedef struct { + /** A proxy IP mask to match */ + apr_ipsubnet_t *ip; + /** Flagged if internal, otherwise an external trusted proxy */ + void *internal; +} remoteip_proxymatch_t; + +typedef struct { + /** The header to retrieve a proxy-via ip list */ + const char *header_name; + /** A header to record the proxied IP's + * (removed as the physical connection and + * from the proxy-via ip header value list) + */ + const char *proxies_header_name; + /** A list of trusted proxies, ideally configured + * with the most commonly encountered listed first + */ + apr_array_header_t *proxymatch_ip; +} remoteip_config_t; + +typedef struct { + apr_sockaddr_t *remote_addr; + char *remote_ip; + /** The list of proxy ip's ignored as remote ip's */ + const char *proxy_ips; + /** The remaining list of untrusted proxied remote ip's */ + const char *proxied_remote; +} remoteip_req_t; + +static void *create_remoteip_server_config(apr_pool_t *p, server_rec *s) +{ + remoteip_config_t *config = apr_pcalloc(p, sizeof *config); + /* config->header_name = NULL; + * config->proxies_header_name = NULL; + */ + return config; +} + +static void *merge_remoteip_server_config(apr_pool_t *p, void *globalv, + void *serverv) +{ + remoteip_config_t *global = (remoteip_config_t *) globalv; + remoteip_config_t *server = (remoteip_config_t *) serverv; + remoteip_config_t *config; + + config = (remoteip_config_t *) apr_palloc(p, sizeof(*config)); + config->header_name = server->header_name + ? server->header_name + : global->header_name; + config->proxies_header_name = server->proxies_header_name + ? server->proxies_header_name + : global->proxies_header_name; + config->proxymatch_ip = server->proxymatch_ip + ? server->proxymatch_ip + : global->proxymatch_ip; + return config; +} + +static const char *header_name_set(cmd_parms *cmd, void *dummy, + const char *arg) +{ + remoteip_config_t *config = ap_get_module_config(cmd->server->module_config, + &remoteip_module); + config->header_name = arg; + return NULL; +} + +static const char *proxies_header_name_set(cmd_parms *cmd, void *dummy, + const char *arg) +{ + remoteip_config_t *config = ap_get_module_config(cmd->server->module_config, + &remoteip_module); + config->proxies_header_name = arg; + return NULL; +} + +/* Would be quite nice if APR exported this */ +/* apr:network_io/unix/sockaddr.c */ +static int looks_like_ip(const char *ipstr) +{ + if (ap_strchr_c(ipstr, ':')) { + /* definitely not a hostname; assume it is intended to be an IPv6 address */ + return 1; + } + + /* simple IPv4 address string check */ + while ((*ipstr == '.') || apr_isdigit(*ipstr)) + ipstr++; + return (*ipstr == '\0'); +} + +static const char *proxies_set(cmd_parms *cmd, void *cfg, + const char *arg) +{ + remoteip_config_t *config = ap_get_module_config(cmd->server->module_config, + &remoteip_module); + remoteip_proxymatch_t *match; + apr_status_t rv; + char *ip = apr_pstrdup(cmd->temp_pool, arg); + char *s = ap_strchr(ip, '/'); + if (s) { + *s++ = '\0'; + } + + if (!config->proxymatch_ip) { + config->proxymatch_ip = apr_array_make(cmd->pool, 1, sizeof(*match)); + } + match = (remoteip_proxymatch_t *) apr_array_push(config->proxymatch_ip); + match->internal = cmd->info; + + if (looks_like_ip(ip)) { + /* Note s may be null, that's fine (explicit host) */ + rv = apr_ipsubnet_create(&match->ip, ip, s, cmd->pool); + } + else + { + apr_sockaddr_t *temp_sa; + + if (s) { + return apr_pstrcat(cmd->pool, "RemoteIP: Error parsing IP ", arg, + " the subnet /", s, " is invalid for ", + cmd->cmd->name, NULL); + } + + rv = apr_sockaddr_info_get(&temp_sa, ip, APR_UNSPEC, 0, + APR_IPV4_ADDR_OK, cmd->temp_pool); + while (rv == APR_SUCCESS) + { + apr_sockaddr_ip_get(&ip, temp_sa); + rv = apr_ipsubnet_create(&match->ip, ip, NULL, cmd->pool); + if (!(temp_sa = temp_sa->next)) { + break; + } + match = (remoteip_proxymatch_t *) + apr_array_push(config->proxymatch_ip); + match->internal = cmd->info; + } + } + + if (rv != APR_SUCCESS) { + char msgbuf[128]; + apr_strerror(rv, msgbuf, sizeof(msgbuf)); + return apr_pstrcat(cmd->pool, "RemoteIP: Error parsing IP ", arg, + " (", msgbuf, " error) for ", cmd->cmd->name, NULL); + } + + return NULL; +} + +static const char *proxylist_read(cmd_parms *cmd, void *cfg, + const char *filename) +{ + char lbuf[MAX_STRING_LEN]; + char *arg; + const char *args; + const char *errmsg; + ap_configfile_t *cfp; + apr_status_t rv; + + filename = ap_server_root_relative(cmd->temp_pool, filename); + rv = ap_pcfg_openfile(&cfp, cmd->temp_pool, filename); + if (rv != APR_SUCCESS) { + return apr_psprintf(cmd->pool, "%s: Could not open file %s: %s", + cmd->cmd->name, filename, + apr_strerror(rv, lbuf, sizeof(lbuf))); + } + + while (!(ap_cfg_getline(lbuf, MAX_STRING_LEN, cfp))) { + args = lbuf; + while (*(arg = ap_getword_conf(cmd->temp_pool, &args)) != '\0') { + if (*arg == '#' || *arg == '\0') { + break; + } + errmsg = proxies_set(cmd, cfg, arg); + if (errmsg) { + errmsg = apr_psprintf(cmd->pool, "%s at line %d of %s", + errmsg, cfp->line_number, filename); + return errmsg; + } + } + } + + ap_cfg_closefile(cfp); + return NULL; +} + +static int remoteip_modify_request(request_rec *r) +{ + conn_rec *c = r->connection; + remoteip_config_t *config = (remoteip_config_t *) + ap_get_module_config(r->server->module_config, &remoteip_module); + remoteip_req_t *req = NULL; + + apr_sockaddr_t *temp_sa; + + apr_status_t rv; + char *remote; + char *proxy_ips = NULL; + char *parse_remote; + char *eos; + unsigned char *addrbyte; + void *internal = NULL; + + if (!config->header_name) { + return DECLINED; + } + + remote = (char *) apr_table_get(r->headers_in, config->header_name); + if (!remote) { + return OK; + } + remote = apr_pstrdup(r->pool, remote); + + temp_sa = c->remote_addr; + + while (remote) { + + /* verify c->remote_addr is trusted if there is a trusted proxy list + */ + if (config->proxymatch_ip) { + int i; + remoteip_proxymatch_t *match; + match = (remoteip_proxymatch_t *)config->proxymatch_ip->elts; + for (i = 0; i < config->proxymatch_ip->nelts; ++i) { + if (apr_ipsubnet_test(match[i].ip, c->remote_addr)) { + internal = match[i].internal; + break; + } + } + if (i && i >= config->proxymatch_ip->nelts) { + break; + } + } + + if ((parse_remote = strrchr(remote, ',')) == NULL) { + parse_remote = remote; + remote = NULL; + } + else { + *(parse_remote++) = '\0'; + } + + while (*parse_remote == ' ') { + ++parse_remote; + } + + eos = parse_remote + strlen(parse_remote) - 1; + while (eos >= parse_remote && *eos == ' ') { + *(eos--) = '\0'; + } + + if (eos < parse_remote) { + if (remote) { + *(remote + strlen(remote)) = ','; + } + else { + remote = parse_remote; + } + break; + } + + /* We map as IPv4 rather than IPv6 for equivilant host names + * or IPV4OVERIPV6 + */ + rv = apr_sockaddr_info_get(&temp_sa, parse_remote, + APR_UNSPEC, temp_sa->port, + APR_IPV4_ADDR_OK, r->pool); + if (rv != APR_SUCCESS) { + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, + "RemoteIP: Header %s value of %s cannot be parsed " + "as a client IP", + config->header_name, parse_remote); + + if (remote) { + *(remote + strlen(remote)) = ','; + } + else { + remote = parse_remote; + } + break; + + } + + addrbyte = (unsigned char *) &temp_sa->sa.sin.sin_addr; + + /* For intranet (Internal proxies) ignore all restrictions below */ + if (!internal + && ((temp_sa->family == APR_INET + /* For internet (non-Internal proxies) deny all + * RFC3330 designated local/private subnets: + * 10.0.0.0/8 169.254.0.0/16 192.168.0.0/16 + * 127.0.0.0/8 172.16.0.0/12 + */ + && (addrbyte[0] == 10 + || addrbyte[0] == 127 + || (addrbyte[0] == 169 && addrbyte[1] == 254) + || (addrbyte[0] == 172 && (addrbyte[1] & 0xf0) == 16) + || (addrbyte[0] == 192 && addrbyte[1] == 168))) +#if APR_HAVE_IPV6 + || (temp_sa->family == APR_INET6 + /* For internet (non-Internal proxies) we translated + * IPv4-over-IPv6-mapped addresses as IPv4, above. + * Accept only Global Unicast 2000::/3 defined by RFC4291 + */ + && ((temp_sa->sa.sin6.sin6_addr.s6_addr[0] & 0xe0) != 0x20)) +#endif + )) { + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r, + "RemoteIP: Header %s value of %s appears to be " + "a private IP or nonsensical. Ignored", + config->header_name, parse_remote); + if (remote) { + *(remote + strlen(remote)) = ','; + } + else { + remote = parse_remote; + } + + break; + } + + /* save away our results */ + if (!req) { + req = (remoteip_req_t *) apr_palloc(r->pool, sizeof(remoteip_req_t)); + } + + /* Set remote_ip string */ + if (!internal) { + if (proxy_ips) { + proxy_ips = apr_pstrcat(r->pool, proxy_ips, ", ", + c->remote_ip, NULL); + } + else { + proxy_ips = c->remote_ip; + } + } + + req->remote_addr = temp_sa; + apr_sockaddr_ip_get(&req->remote_ip, req->remote_addr); + } + + /* Nothing happened? */ + if (!req) { + return OK; + } + + req->proxied_remote = remote; + req->proxy_ips = proxy_ips; + + if (req->proxied_remote) { + apr_table_setn(r->headers_in, config->header_name, + req->proxied_remote); + } + else { + apr_table_unset(r->headers_in, config->header_name); + } + if (req->proxy_ips) { + apr_table_setn(r->notes, "remoteip-proxy-ip-list", req->proxy_ips); + if (config->proxies_header_name) { + apr_table_setn(r->headers_in, config->proxies_header_name, + req->proxy_ips); + } + } + + c->remote_addr = req->remote_addr; + c->remote_ip = req->remote_ip; + + ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, + req->proxy_ips + ? "Using %s as client's IP by proxies %s" + : "Using %s as client's IP by internal proxies", + req->remote_ip, req->proxy_ips); + return OK; +} + +static const command_rec remoteip_cmds[] = +{ + AP_INIT_TAKE1("RemoteIPHeader", header_name_set, NULL, RSRC_CONF, + "Specifies a request header to trust as the client IP, " + "e.g. X-Forwarded-For"), + AP_INIT_TAKE1("RemoteIPProxiesHeader", proxies_header_name_set, + NULL, RSRC_CONF, + "Specifies a request header to record proxy IP's, " + "e.g. X-Forwarded-By; if not given then do not record"), + AP_INIT_ITERATE("RemoteIPTrustedProxy", proxies_set, 0, RSRC_CONF, + "Specifies one or more proxies which are trusted " + "to present IP headers"), + AP_INIT_ITERATE("RemoteIPInternalProxy", proxies_set, (void*)1, RSRC_CONF, + "Specifies one or more internal (transparent) proxies " + "which are trusted to present IP headers"), + AP_INIT_TAKE1("RemoteIPTrustedProxyList", proxylist_read, 0, + RSRC_CONF | EXEC_ON_READ, + "The filename to read the list of trusted proxies, " + "see the RemoteIPTrustedProxy directive"), + AP_INIT_TAKE1("RemoteIPInternalProxyList", proxylist_read, (void*)1, + RSRC_CONF | EXEC_ON_READ, + "The filename to read the list of internal proxies, " + "see the RemoteIPInternalProxy directive"), + { NULL } +}; + +static void register_hooks(apr_pool_t *p) +{ + ap_hook_post_read_request(remoteip_modify_request, NULL, NULL, APR_HOOK_FIRST); +} + +module AP_MODULE_DECLARE_DATA remoteip_module = { + STANDARD20_MODULE_STUFF, + NULL, /* create per-directory config structure */ + NULL, /* merge per-directory config structures */ + create_remoteip_server_config, /* create per-server config structure */ + merge_remoteip_server_config, /* merge per-server config structures */ + remoteip_cmds, /* command apr_table_t */ + register_hooks /* register hooks */ +}; diff --git a/src/patch/mysql-5.5-fix-arm-client_plugin.patch b/src/patch/mysql-5.5-fix-arm-client_plugin.patch new file mode 100644 index 00000000..6c6f30ec --- /dev/null +++ b/src/patch/mysql-5.5-fix-arm-client_plugin.patch @@ -0,0 +1,37 @@ +diff -ruN mysql-5.5.42.orig/sql-common/client_plugin.c mysql-5.5.42/sql-common/client_plugin.c +--- mysql-5.5.42.orig/sql-common/client_plugin.c 2015-01-07 04:39:40.000000000 +0800 ++++ mysql-5.5.42/sql-common/client_plugin.c 2015-03-24 10:36:45.682700014 +0800 +@@ -233,6 +233,7 @@ + { + MYSQL mysql; + struct st_mysql_client_plugin **builtin; ++ va_list dummy; + + if (initialized) + return 0; +@@ -249,7 +250,7 @@ + pthread_mutex_lock(&LOCK_load_client_plugin); + + for (builtin= mysql_client_builtins; *builtin; builtin++) +- add_plugin(&mysql, *builtin, 0, 0, 0); ++ add_plugin(&mysql, *builtin, 0, 0, dummy); + + pthread_mutex_unlock(&LOCK_load_client_plugin); + +@@ -293,6 +294,7 @@ + mysql_client_register_plugin(MYSQL *mysql, + struct st_mysql_client_plugin *plugin) + { ++ va_list dummy; + if (is_not_initialized(mysql, plugin->name)) + return NULL; + +@@ -307,7 +309,7 @@ + plugin= NULL; + } + else +- plugin= add_plugin(mysql, plugin, 0, 0, 0); ++ plugin= add_plugin(mysql, plugin, 0, 0, dummy); + + pthread_mutex_unlock(&LOCK_load_client_plugin); + return plugin; diff --git a/src/patch/mysql-openssl.patch b/src/patch/mysql-openssl.patch new file mode 100644 index 00000000..bcdc1d2b --- /dev/null +++ b/src/patch/mysql-openssl.patch @@ -0,0 +1,13 @@ +--- mysql-5.5.31/vio/viossl.c~ 2013-03-25 14:14:58.000000000 +0100 ++++ mysql-5.5.31/vio/viossl.c 2013-04-18 16:58:38.552557538 +0200 +@@ -172,8 +172,10 @@ + SSL_SESSION_set_timeout(SSL_get_session(ssl), timeout); + SSL_set_fd(ssl, vio->sd); + #ifndef HAVE_YASSL ++#ifdef SSL_OP_NO_COMPRESSION + SSL_set_options(ssl, SSL_OP_NO_COMPRESSION); + #endif ++#endif + + if ((r= connect_accept_func(ssl)) < 1) + { diff --git a/src/patch/php-5.2-multipart-form-data.patch b/src/patch/php-5.2-multipart-form-data.patch new file mode 100644 index 00000000..ec31ba79 --- /dev/null +++ b/src/patch/php-5.2-multipart-form-data.patch @@ -0,0 +1,82 @@ +diff --git a/main/rfc1867.c b/main/rfc1867.c +index 861fe50..77843a3 100644 +--- a/main/rfc1867.c ++++ b/main/rfc1867.c +@@ -34,6 +34,7 @@ + #include "rfc1867.h" + #include "php_ini.h" + #include "ext/standard/php_string.h" ++#include "ext/standard/php_smart_str.h" + + #define DEBUG_FILE_UPLOAD ZEND_DEBUG + +@@ -463,6 +464,69 @@ static int find_boundary(multipart_buffer *self, char *boundary TSRMLS_DC) + static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header TSRMLS_DC) + { + char *line; ++ mime_header_entry entry = {0}; ++ smart_str buf_value = {0}; ++ char *key = NULL; ++ ++ /* didn't find boundary, abort */ ++ if (!find_boundary(self, self->boundary TSRMLS_CC)) { ++ return 0; ++ } ++ ++ /* get lines of text, or CRLF_CRLF */ ++ ++ while( (line = get_line(self TSRMLS_CC)) && line[0] != '\0' ) ++ { ++ /* add header to table */ ++ char *value = NULL; ++ ++ //if (php_rfc1867_encoding_translation(TSRMLS_C)) { ++ // self->input_encoding = zend_multibyte_encoding_detector((unsigned char *)line, strlen(line), self->detect_order, self->detect_order_size TSRMLS_CC); ++ //} ++ ++ /* space in the beginning means same header */ ++ if (!isspace(line[0])) { ++ value = strchr(line, ':'); ++ } ++ ++ if (value) { ++ if(buf_value.c && key) { ++ /* new entry, add the old one to the list */ ++ smart_str_0(&buf_value); ++ entry.key = key; ++ entry.value = buf_value.c; ++ zend_llist_add_element(header, &entry); ++ buf_value.c = NULL; ++ key = NULL; ++ } ++ ++ *value = '\0'; ++ do { value++; } while(isspace(*value)); ++ ++ key = estrdup(line); ++ smart_str_appends(&buf_value, value); ++ } else if (buf_value.c) { /* If no ':' on the line, add to previous line */ ++ smart_str_appends(&buf_value, line); ++ } else { ++ continue; ++ } ++ } ++ if(buf_value.c && key) { ++ /* add the last one to the list */ ++ smart_str_0(&buf_value); ++ entry.key = key; ++ entry.value = buf_value.c; ++ zend_llist_add_element(header, &entry); ++ } ++ ++ return 1; ++} ++ ++ ++ ++static int multipart_buffer_headers_bak(multipart_buffer *self, zend_llist *header TSRMLS_DC) ++{ ++ char *line; + mime_header_entry prev_entry, entry; + int prev_len, cur_len; + diff --git a/src/patch/php-5.2.17-max-input-vars.patch b/src/patch/php-5.2.17-max-input-vars.patch new file mode 100644 index 00000000..bbc65696 --- /dev/null +++ b/src/patch/php-5.2.17-max-input-vars.patch @@ -0,0 +1,81 @@ +diff -u -r php-5.2.17/configure php-5.2.17-patched/configure +--- php-5.2.17/configure 2011-01-07 07:04:43.000000000 +0800 ++++ php-5.2.17-patched/configure 2011-12-31 11:46:11.000000000 +0800 +@@ -2165,7 +2165,7 @@ + PHP_MAJOR_VERSION=5 + PHP_MINOR_VERSION=2 + PHP_RELEASE_VERSION=17 +-PHP_EXTRA_VERSION="" ++PHP_EXTRA_VERSION="p1" + PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" + PHP_VERSION_ID=`expr $PHP_MAJOR_VERSION \* 10000 + $PHP_MINOR_VERSION \* 100 + $PHP_RELEASE_VERSION` + +diff -u -r php-5.2.17/configure.in php-5.2.17-patched/configure.in +--- php-5.2.17/configure.in 2011-01-07 07:01:19.000000000 +0800 ++++ php-5.2.17-patched/configure.in 2011-12-31 09:59:05.000000000 +0800 +@@ -42,7 +42,7 @@ + PHP_MAJOR_VERSION=5 + PHP_MINOR_VERSION=2 + PHP_RELEASE_VERSION=17 +-PHP_EXTRA_VERSION="" ++PHP_EXTRA_VERSION="p1" + PHP_VERSION="$PHP_MAJOR_VERSION.$PHP_MINOR_VERSION.$PHP_RELEASE_VERSION$PHP_EXTRA_VERSION" + PHP_VERSION_ID=`expr [$]PHP_MAJOR_VERSION \* 10000 + [$]PHP_MINOR_VERSION \* 100 + [$]PHP_RELEASE_VERSION` + +diff -u -r php-5.2.17/main/main.c php-5.2.17-patched/main/main.c +--- php-5.2.17/main/main.c 2010-06-20 04:47:24.000000000 +0800 ++++ php-5.2.17-patched/main/main.c 2011-12-31 09:59:05.000000000 +0800 +@@ -457,6 +457,7 @@ + + STD_PHP_INI_BOOLEAN("allow_url_fopen", "1", PHP_INI_SYSTEM, OnUpdateBool, allow_url_fopen, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("allow_url_include", "0", PHP_INI_SYSTEM, OnUpdateBool, allow_url_include, php_core_globals, core_globals) ++ STD_PHP_INI_ENTRY("max_input_vars", "1000", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateLongGEZero, max_input_vars, php_core_globals, core_globals) + STD_PHP_INI_BOOLEAN("always_populate_raw_post_data", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, always_populate_raw_post_data, php_core_globals, core_globals) + + STD_PHP_INI_ENTRY("realpath_cache_size", "16K", PHP_INI_SYSTEM, OnUpdateLong, realpath_cache_size_limit, virtual_cwd_globals, cwd_globals) +diff -u -r php-5.2.17/main/php_globals.h php-5.2.17-patched/main/php_globals.h +--- php-5.2.17/main/php_globals.h 2010-01-03 17:23:27.000000000 +0800 ++++ php-5.2.17-patched/main/php_globals.h 2011-12-31 09:59:05.000000000 +0800 +@@ -160,6 +160,7 @@ + zend_bool com_initialized; + #endif + long max_input_nesting_level; ++ long max_input_vars; + zend_bool in_user_include; + zend_bool in_error_log; + }; +diff -u -r php-5.2.17/main/php_variables.c php-5.2.17-patched/main/php_variables.c +--- php-5.2.17/main/php_variables.c 2010-01-03 17:23:27.000000000 +0800 ++++ php-5.2.17-patched/main/php_variables.c 2011-12-31 09:59:05.000000000 +0800 +@@ -187,6 +187,9 @@ + } + if (zend_symtable_find(symtable1, escaped_index, index_len + 1, (void **) &gpc_element_p) == FAILURE + || Z_TYPE_PP(gpc_element_p) != IS_ARRAY) { ++ if (zend_hash_num_elements(symtable1) >= PG(max_input_vars)) { ++ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); ++ } + MAKE_STD_ZVAL(gpc_element); + array_init(gpc_element); + zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); +@@ -232,6 +235,9 @@ + zend_symtable_exists(symtable1, escaped_index, index_len + 1)) { + zval_ptr_dtor(&gpc_element); + } else { ++ if (zend_hash_num_elements(symtable1) >= PG(max_input_vars)) { ++ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Input variables exceeded %ld. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars)); ++ } + zend_symtable_update(symtable1, escaped_index, index_len + 1, &gpc_element, sizeof(zval *), (void **) &gpc_element_p); + } + if (escaped_index != index) { +diff -u -r php-5.2.17/main/php_version.h php-5.2.17-patched/main/php_version.h +--- php-5.2.17/main/php_version.h 2011-01-07 07:01:19.000000000 +0800 ++++ php-5.2.17-patched/main/php_version.h 2011-12-31 11:46:13.000000000 +0800 +@@ -3,6 +3,6 @@ + #define PHP_MAJOR_VERSION 5 + #define PHP_MINOR_VERSION 2 + #define PHP_RELEASE_VERSION 17 +-#define PHP_EXTRA_VERSION "" +-#define PHP_VERSION "5.2.17" ++#define PHP_EXTRA_VERSION "p1" ++#define PHP_VERSION "5.2.17p1" + #define PHP_VERSION_ID 50217 diff --git a/src/patch/php-5.2.17-xml.patch b/src/patch/php-5.2.17-xml.patch new file mode 100644 index 00000000..e5dbab79 --- /dev/null +++ b/src/patch/php-5.2.17-xml.patch @@ -0,0 +1,51 @@ +--- ext/dom/node.c 2012-08-06 17:49:48.826716692 +0800 ++++ ext/dom/node.c 2012-08-06 17:52:47.633484660 +0800 +@@ -1895,9 +1895,17 @@ static void dom_canonicalization(INTERNA + RETVAL_FALSE; + } else { + if (mode == 0) { ++#ifdef LIBXML2_NEW_BUFFER ++ ret = xmlOutputBufferGetSize(buf); ++#else + ret = buf->buffer->use; ++#endif + if (ret > 0) { ++#ifdef LIBXML2_NEW_BUFFER ++ RETVAL_STRINGL((char *) xmlOutputBufferGetContent(buf), ret, 1); ++#else + RETVAL_STRINGL((char *) buf->buffer->content, ret, 1); ++#endif + } else { + RETVAL_EMPTY_STRING(); + } +--- ext/dom/documenttype.c 2012-08-06 18:02:16.019640870 +0800 ++++ ext/dom/documenttype.c 2012-08-06 18:06:16.612228905 +0800 +@@ -205,7 +205,13 @@ int dom_documenttype_internal_subset_rea + if (buff != NULL) { + xmlNodeDumpOutput (buff, NULL, (xmlNodePtr) intsubset, 0, 0, NULL); + xmlOutputBufferFlush(buff); ++ ++#ifdef LIBXML2_NEW_BUFFER ++ ZVAL_STRINGL(*retval, xmlOutputBufferGetContent(buff), ++ xmlOutputBufferGetSize(buff), 1); ++#else + ZVAL_STRINGL(*retval, buff->buffer->content, buff->buffer->use, 1); ++#endif + (void)xmlOutputBufferClose(buff); + return SUCCESS; + } +--- ext/simplexml/simplexml.c 2012-08-06 18:10:44.621017026 +0800 ++++ ext/simplexml/simplexml.c 2012-08-06 18:12:48.016270419 +0800 +@@ -1417,7 +1417,12 @@ SXE_METHOD(asXML) + + xmlNodeDumpOutput(outbuf, (xmlDocPtr) sxe->document->ptr, node, 0, 0, ((xmlDocPtr) sxe->document->ptr)->encoding); + xmlOutputBufferFlush(outbuf); ++#ifdef LIBXML2_NEW_BUFFER ++ RETVAL_STRINGL((char *)xmlOutputBufferGetContent(outbuf), ++ xmlOutputBufferGetSize(outbuf), 1); ++#else + RETVAL_STRINGL((char *)outbuf->buffer->content, outbuf->buffer->use, 1); ++#endif + xmlOutputBufferClose(outbuf); + } + } else { diff --git a/src/patch/php-5.3-multipart-form-data.patch b/src/patch/php-5.3-multipart-form-data.patch new file mode 100644 index 00000000..285299d5 --- /dev/null +++ b/src/patch/php-5.3-multipart-form-data.patch @@ -0,0 +1,80 @@ +diff --git a/main/rfc1867.c b/main/rfc1867.c +index b3f94ec..7613119 100644 +--- a/main/rfc1867.c ++++ b/main/rfc1867.c +@@ -33,6 +33,8 @@ + #include "php_variables.h" + #include "rfc1867.h" + #include "ext/standard/php_string.h" ++#include "ext/standard/php_smart_str.h" ++ + + #define DEBUG_FILE_UPLOAD ZEND_DEBUG + +@@ -462,6 +464,66 @@ static int find_boundary(multipart_buffer *self, char *boundary TSRMLS_DC) + static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header TSRMLS_DC) + { + char *line; ++ mime_header_entry entry = {0}; ++ smart_str buf_value = {0}; ++ char *key = NULL; ++ ++ /* didn't find boundary, abort */ ++ if (!find_boundary(self, self->boundary TSRMLS_CC)) { ++ return 0; ++ } ++ ++ /* get lines of text, or CRLF_CRLF */ ++ ++ while( (line = get_line(self TSRMLS_CC)) && line[0] != '\0' ) ++ { ++ /* add header to table */ ++ char *value = NULL; ++ ++ /*if (php_rfc1867_encoding_translation(TSRMLS_C)) { ++ //self->input_encoding = zend_multibyte_encoding_detector((unsigned char *)line, strlen(line), self->detect_order, self->detect_order_size TSRMLS_CC); ++ }*/ ++ ++ /* space in the beginning means same header */ ++ if (!isspace(line[0])) { ++ value = strchr(line, ':'); ++ } ++ ++ if (value) { ++ if(buf_value.c && key) { ++ /* new entry, add the old one to the list */ ++ smart_str_0(&buf_value); ++ entry.key = key; ++ entry.value = buf_value.c; ++ zend_llist_add_element(header, &entry); ++ buf_value.c = NULL; ++ key = NULL; ++ } ++ ++ *value = '\0'; ++ do { value++; } while(isspace(*value)); ++ ++ key = estrdup(line); ++ smart_str_appends(&buf_value, value); ++ } else if (buf_value.c) { /* If no ':' on the line, add to previous line */ ++ smart_str_appends(&buf_value, line); ++ } else { ++ continue; ++ } ++ } ++ if(buf_value.c && key) { ++ /* add the last one to the list */ ++ smart_str_0(&buf_value); ++ entry.key = key; ++ entry.value = buf_value.c; ++ zend_llist_add_element(header, &entry); ++ } ++ ++ return 1; ++} ++static int multipart_buffer_headers_bak(multipart_buffer *self, zend_llist *header TSRMLS_DC) ++{ ++ char *line; + mime_header_entry prev_entry, entry; + int prev_len, cur_len; + diff --git a/tools/backup.sh b/tools/backup.sh new file mode 100644 index 00000000..4612c966 --- /dev/null +++ b/tools/backup.sh @@ -0,0 +1,87 @@ +#!/bin/bash + +#Funciont: Backup website and mysql database +#Author: licess +#Website: http://lnmp.org + +#IMPORTANT!!!Please Setting the following Values! + +Backup_Home="/home/backup/" +MySQL_Dump="/usr/local/mysql/bin/mysqldump" +######~Set Directory you want to backup~###### +Backup_Dir=("/home/wwwroot/vpser.net" "/home/wwwroot/lnmp.org") + +######~Set MySQL Database you want to backup~###### +Backup_Database=("lnmp" "vpser") + +######~Set MySQL UserName and password~###### +MYSQL_UserName='root' +MYSQL_PassWord='yourrootpassword' + +######~Enable Ftp Backup~###### +Enable_FTP=0 +# 0: enable; 1: disable +######~Set FTP Information~###### +FTP_Host='1.2.3.4' +FTP_Username='vpser.net' +FTP_Password='yourftppassword' +FTP_Dir="backup" + +#Values Setting END! + +TodayWWWBackup=www-*-$(date +"%Y%m%d").tar.gz +TodayDBBackup=db-*-$(date +"%Y%m%d").sql +OldWWWBackup=www-*-$(date -d -3day +"%Y%m%d").tar.gz +OldDBBackup=db-*-$(date -d -3day +"%Y%m%d").sql + +Backup_Dir() +{ + Backup_Path=$1 + Dir_Name=`echo ${Backup_Path##*/}` + Pre_Dir=`echo ${Backup_Path}|sed 's/'${Dir_Name}'//g'` + tar zcf ${Backup_Home}www-${Dir_Name}-$(date +"%Y%m%d").tar.gz -C ${Pre_Dir} ${Dir_Name} +} +Backup_Sql() +{ + ${MySQL_Dump} -u$MYSQL_UserName -p$MYSQL_PassWord $1 > ${Backup_Home}db-$1-$(date +"%Y%m%d").sql +} + +if [ ! -f ${MySQL_Dump} ]; then + echo "mysqldump command not found.please check your setting." + exit 1 +fi + +if [ ! -d ${Backup_Home} ]; then + mkdir -p ${Backup_Home} +fi + +type lftp >/dev/null 2>&1 || { echo >&2 "lftp command not found. Install: centos:yum install lftp,debian/ubuntu:apt-get install lftp."; } + +echo "Backup website files..." +for dd in ${Backup_Dir[@]};do + Backup_Dir ${dd} +done + +echo "Backup Databases..." +for db in ${Backup_Database[@]};do + Backup_Sql ${db} +done + +echo "Delete old backup files..." +rm -f ${Backup_Home}${OldWWWBackup} +rm -f ${Backup_Home}$}OldDBBackup} + +if [ ${Enable_FTP} = 0 ]; then + echo "Uploading backup files to ftp..." + cd ${Backup_Home} + lftp ${FTP_Host} -u ${FTP_Username},${FTP_Password} << EOF +cd ${FTP_Dir} +mrm ${OldWWWBackup} +mrm ${OldDBBackup} +mput ${TodayWWWBackup} +mput ${TodayDBBackup} +bye +EOF + +echo "complete." +fi \ No newline at end of file diff --git a/check502.sh b/tools/check502.sh similarity index 88% rename from check502.sh rename to tools/check502.sh index b25cf012..72526c66 100644 --- a/check502.sh +++ b/tools/check502.sh @@ -7,5 +7,5 @@ CheckURL="http://www.vpser.net" STATUS_CODE=`curl -o /dev/null -m 10 --connect-timeout 10 -s -w %{http_code} $CheckURL` #echo "$CheckURL Status Code:\t$STATUS_CODE" if [ "$STATUS_CODE" = "502" ]; then - /etc/init.d/php-fpm restart + /etc/init.d/php-fpm restart fi \ No newline at end of file diff --git a/cut_nginx_logs.sh b/tools/cut_nginx_logs.sh similarity index 100% rename from cut_nginx_logs.sh rename to tools/cut_nginx_logs.sh diff --git a/tools/denyhosts.sh b/tools/denyhosts.sh new file mode 100644 index 00000000..c6725e9e --- /dev/null +++ b/tools/denyhosts.sh @@ -0,0 +1,49 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script, please use root to install lnmp" + exit 1 +fi + +. ../include/main.sh +Get_Dist_Name + +Press_Start + +if [ "$PM" = "yum" ]; then + yum install python rsyslog -y + service rsyslog restart +elif [ "$PM" = "apt" ]; then + apt-get update + apt-get install python rsyslog -y + /etc/init.d/rsyslog restart + /etc/init.d/rsyslog restart +fi + +echo "Downloading..." +cd ../src +Download_Files http://soft.vpser.net/security/denyhosts/DenyHosts-2.6.tar.gz DenyHosts-2.6.tar.gz +Tar_Cd DenyHosts-2.6.tar.gz DenyHosts-2.6 +echo "Installing..." +python setup.py install + +echo "Copy files..." +cd /usr/share/denyhosts/ +cp denyhosts.cfg-dist denyhosts.cfg +cp daemon-control-dist daemon-control +chown root daemon-control +chmod 700 daemon-control +\cp /usr/share/denyhosts/daemon-control /etc/init.d/denyhosts + +sed -i '/STATE_LOCK_EXISTS\ \=\ \-2/aif not os.path.exists("/var/lock/subsys"): os.makedirs("/var/lock/subsys")' /etc/init.d/denyhosts +if [ "$PM" = "apt" ]; then + sed -i 's#/var/log/secure#/var/log/auth.log#g' /usr/share/denyhosts/denyhosts.cfg + ln -sf /usr/local/bin/denyhosts.py /usr/bin/denyhosts.py +fi + +StartUp denyhosts +echo "Start DenyHosts..." +/etc/init.d/denyhosts start \ No newline at end of file diff --git a/tools/denyhosts_removeip.sh b/tools/denyhosts_removeip.sh new file mode 100644 index 00000000..45c1e780 --- /dev/null +++ b/tools/denyhosts_removeip.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Author:licess +# Website:http://www.vpser.net & http://lnmp.org + +HOST=$1 +if [ -z "${HOST}" ]; then + echo "Usage:$0 IP" + exit 1 +fi + +echo "Remove IP:${HOST} from denyhosts..." +/etc/init.d/denyhosts stop +echo ' +/etc/hosts.deny +/usr/share/denyhosts/data/hosts +/usr/share/denyhosts/data/hosts-restricted +/usr/share/denyhosts/data/hosts-root +/usr/share/denyhosts/data/hosts-valid +/usr/share/denyhosts/data/users-hosts +' | grep -v "^$" | xargs sed -i "/${HOST}/d" +echo " done" +/etc/init.d/denyhosts start \ No newline at end of file diff --git a/tools/fail2ban.sh b/tools/fail2ban.sh new file mode 100644 index 00000000..37f80ddf --- /dev/null +++ b/tools/fail2ban.sh @@ -0,0 +1,50 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script, please use root to install lnmp" + exit 1 +fi + +. ../include/main.sh +Get_Dist_Name + +Press_Start + +if [ "$PM" = "yum" ]; then + yum install python iptables rsyslog -y + service rsyslog restart +elif [ "$PM" = "apt" ]; then + apt-get update + apt-get install python iptables rsyslog -y + /etc/init.d/rsyslog restart +fi + +echo "Downloading..." +cd ../src +Download_Files http://soft.vpser.net/security/fail2ban/fail2ban-0.9.1.tar.gz fail2ban-0.9.1.tar.gz +tar zxf fail2ban-0.9.1.tar.gz && cd fail2ban-0.9.1 +echo "Installing..." +python setup.py install + +echo "Copy configure file..." +\cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local +sed -i 's/# \[sshd\]/\[sshd\]/g' /etc/fail2ban/jail.local +sed -i 's/# enabled = true/enabled = true/g' /etc/fail2ban/jail.local + +echo "Copy init files..." +mkdir /var/run/fail2ban +\cp ../../init.d/init.d.fail2ban /etc/init.d/fail2ban +if [ "$PM" = "yum" ]; then + sed -i 's#%(sshd_log)s#/var/log/secure#g' /etc/fail2ban/jail.local +elif [ "$PM" = "apt" ]; then + ln -sf /usr/local/bin/fail2ban-client /usr/bin/fail2ban-client +fi +chmod +x /etc/init.d/fail2ban + +StartUp fail2ban + +echo "Start fail2ban..." +/etc/init.d/fail2ban start \ No newline at end of file diff --git a/tools/remove_disable_function.sh b/tools/remove_disable_function.sh new file mode 100644 index 00000000..c531df20 --- /dev/null +++ b/tools/remove_disable_function.sh @@ -0,0 +1,89 @@ + #!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script, please use root to install lnmp" + exit 1 +fi + +clear +echo "+-------------------------------------------------------------------+" +echo "| Remove PHP disable functions for LNMP, Written by Licess |" +echo "+-------------------------------------------------------------------+" +echo "| A tool to remove PHP disable_functions for LNMP |" +echo "+-------------------------------------------------------------------+" +echo "| For more information please visit http://www.lnmp.org/ |" +echo "+-------------------------------------------------------------------+" +echo "| Usage: ./remove_disable_function.sh |" +echo "+-------------------------------------------------------------------+" + +cur_dir=$(pwd) + + ver="" + echo "Remove all php disable function please type: 1" + echo "Only remove scandir function please type: 2" + echo "Only remove exec function please type: 3" + read -p "Please input 1 2 or 3:" ver + if [ "$ver" = "" ]; then + ver="1" + fi + + if [ "$ver" = "1" ]; then + echo "You will remove all php disable functions." + elif [ "$ver" = "2" ]; then + echo "You will remove scandir php disable function." + elif [ "$ver" = "3" ]; then + echo "You will remove exec php disable_function." + fi + + get_char() + { + SAVEDSTTY=`stty -g` + stty -echo + stty cbreak + dd if=/dev/tty bs=1 count=1 2> /dev/null + stty -raw + stty echo + stty $SAVEDSTTY + } + echo "" + echo "Press any key to start...or Press Ctrl+c to cancel" + char=`get_char` + + +function remove_all_disable_function() +{ + sed -i 's/disable_functions =.*/disable_functions =/g' /usr/local/php/etc/php.ini +} + +function remove_scandir_function() +{ + sed -i 's/,scandir//g' /usr/local/php/etc/php.ini +} + +function remove_exec_function() +{ + sed -i 's/,exec//g' /usr/local/php/etc/php.ini +} + +if [ "$ver" = "1" ]; then + remove_all_disable_function +elif [ "$ver" = "2" ]; then + remove_scandir_function +elif [ "$ver" = "3" ]; then + remove_exec_function +fi + +if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then +echo "Restarting Apache......" +/etc/init.d/httpd -k restart +else +echo "Restarting php-fpm......" +/etc/init.d/php-fpm restart +fi + +echo "+-------------------------------------------------+" +echo "| Remove php disable funtion completed,enjoy it! |" +echo "+-------------------------------------------------+" \ No newline at end of file diff --git a/tools/reset_mysql_root_password.sh b/tools/reset_mysql_root_password.sh new file mode 100644 index 00000000..f6ac20e1 --- /dev/null +++ b/tools/reset_mysql_root_password.sh @@ -0,0 +1,55 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script!" + exit 1 +fi + +echo "+-------------------------------------------------------------------+" +echo "| Reset MySQL/MariaDB root Password for LNMP, Written by Licess |" +echo "+-------------------------------------------------------------------+" +echo "| A tool to reset MySQL/MariaDB root password for LNMP |" +echo "+-------------------------------------------------------------------+" +echo "| For more information please visit http://www.lnmp.org/ |" +echo "+-------------------------------------------------------------------+" +echo "| Usage: ./reset_mysql_root_password.sh |" +echo "+-------------------------------------------------------------------+" + +if [ -s /usr/local/mariadb/bin/mysql ]; then + M_Name="mariadb" +else + M_Name="mysql" +fi + +mysql_root_password="" +read -p "Enter New MySQL root password: " mysql_root_password +if [ "${mysql_root_password}" = "" ]; then + echo "Error: Password can't be NULL!!" + exit 1 +fi + +echo "Stoping MySQL..." +/etc/init.d/${M_Name} stop +echo "Starting MySQL with skip grant tables" +/usr/local/${M_Name}/bin/mysqld_safe --skip-grant-tables >/dev/null 2>&1 & +echo "using mysql to flush privileges and reset password" +sleep 5 +echo "update user set password = Password('${mysql_root_password}') where User = 'root'" +/usr/local/${M_Name}/bin/mysql -u root mysql << EOF +update user set password = Password('${mysql_root_password}') where User = 'root'; +EOF + +reset_status=`echo $?` +if [ ${reset_status} = "0" ]; then + echo "Password reset succesfully. Now killing mysqld softly" + killall mysqld + sleep 5 + echo "Restarting the actual mysql service" + /etc/init.d/${M_Name} start + echo "Password successfully reset to '${mysql_root_password}'" +else + echo "Reset MySQL root password failed!" +fi \ No newline at end of file diff --git a/ubuntu.sh b/ubuntu.sh deleted file mode 100644 index 18954a6f..00000000 --- a/ubuntu.sh +++ /dev/null @@ -1,1006 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=========================================================================" -echo "LNMP V1.1 for Ubuntu Linux Server, Written by Licess " -echo "=========================================================================" -echo "A tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "=========================================================================" -cur_dir=$(pwd) - -#set mysql root password - - mysqlrootpwd="root" - echo "Please input the root password of mysql:" - read -p "(Default password: root):" mysqlrootpwd - if [ "$mysqlrootpwd" = "" ]; then - mysqlrootpwd="root" - fi - echo "===========================" - echo "mysqlrootpwd=$mysqlrootpwd" - echo "===========================" - -#do you want to install the InnoDB Storage Engine? - -echo "===========================" - - installinnodb="n" - echo "Do you want to install the InnoDB Storage Engine?" - read -p "(Default no,if you want please input: y ,if not please press the enter button):" installinnodb - - case "$installinnodb" in - y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) - echo "You will install the InnoDB Storage Engine" - installinnodb="y" - ;; - n|N|No|NO|no|nO) - echo "You will NOT install the InnoDB Storage Engine!" - installinnodb="n" - ;; - *) - echo "INPUT error,The InnoDB Storage Engine will NOT install!" - installinnodb="n" - esac - -#which PHP Version do you want to install? -echo "===========================" - - isinstallphp53="n" - echo "Install PHP 5.3.28,Please input y" - echo "Install PHP 5.2.17,Please input n or press Enter" - read -p "(Please input y or n):" isinstallphp53 - - case "$isinstallphp53" in - y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) - echo "You will install PHP 5.3.28" - isinstallphp53="y" - ;; - n|N|No|NO|no|nO) - echo "You will install PHP 5.2.17" - isinstallphp53="n" - ;; - *) - echo "INPUT error,You will install PHP 5.2.17" - isinstallphp53="n" - esac - -#which MySQL Version do you want to install? -echo "===========================" - - isinstallmysql55="n" - echo "Install MySQL 5.5.37,Please input y" - echo "Install MySQL 5.1.73,Please input n or press Enter" - echo "Install MariaDB 5.5.37,Please input md" - read -p "(Please input y , n or md):" isinstallmysql55 - - case "$isinstallmysql55" in - y|Y|Yes|YES|yes|yES|yEs|YeS|yeS) - echo "You will install MySQL 5.5.37" - isinstallmysql55="y" - ;; - n|N|No|NO|no|nO) - echo "You will install MySQL 5.1.73" - isinstallmysql55="n" - ;; - md|MD|Md|mD) - echo "You will install MariaDB 5.5.37" - isinstallmysql55="md" - ;; - *) - echo "INPUT error,You will install MySQL 5.1.73" - isinstallmysql55="n" - esac - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start..." - char=`get_char` - -function InitInstall() -{ -cat /etc/issue -uname -a -MemTotal=`free -m | grep Mem | awk '{print $2}'` -echo -e "\n Memory is: ${MemTotal} MB " -apt-get update -apt-get remove -y apache2 apache2-doc apache2-utils apache2.2-common apache2.2-bin apache2-mpm-prefork apache2-doc apache2-mpm-worker mysql-client mysql-server mysql-common php5 php5-common php5-cgi php5-mysql php5-curl php5-gd -killall apache2 -dpkg -l |grep mysql -dpkg -P libmysqlclient15off libmysqlclient15-dev mysql-common -dpkg -l |grep apache -dpkg -P apache2 apache2-doc apache2-mpm-prefork apache2-utils apache2.2-common -dpkg -l |grep php -dpkg -P php5 php5-common php5-cgi php5-mysql php5-curl php5-gd -apt-get purge `dpkg -l | grep php| awk '{print $2}'` - -#Synchronization time -rm -rf /etc/localtime -ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime - -apt-get install -y ntpdate -ntpdate -u pool.ntp.org -date - -#Disable SeLinux -if [ -s /etc/selinux/config ]; then -sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config -fi - -if [ -s /etc/ld.so.conf.d/libc6-xen.conf ]; then -sed -i 's/hwcap 1 nosegneg/hwcap 0 nosegneg/g' /etc/ld.so.conf.d/libc6-xen.conf -fi - -apt-get update -apt-get autoremove -y -apt-get -fy install -apt-get install -y build-essential gcc g++ make -for packages in build-essential gcc g++ make cmake automake autoconf re2c wget cron bzip2 libzip-dev libc6-dev file rcconf flex vim nano bison m4 gawk less make cpp binutils diffutils unzip tar bzip2 libbz2-dev unrar p7zip libncurses5-dev libncurses5 libncurses5-dev libncurses5-dev libtool libevent-dev libpcre3 libpcre3-dev libpcrecpp0 libssl-dev zlibc openssl libsasl2-dev libltdl3-dev libltdl-dev libmcrypt-dev zlib1g zlib1g-dev libbz2-1.0 libbz2-dev libglib2.0-0 libglib2.0-dev libpng3 libjpeg62 libjpeg62-dev libjpeg-dev libpng-dev libpng12-0 libpng12-dev curl libcurl3 libmhash2 libmhash-dev libpq-dev libpq5 gettext libncurses5-dev libcurl4-gnutls-dev libjpeg-dev libpng12-dev libxml2-dev zlib1g-dev libfreetype6 libfreetype6-dev libssl-dev libcurl3 libcurl4-openssl-dev libcurl4-gnutls-dev mcrypt libcap-dev diffutils ca-certificates debian-keyring debian-archive-keyring; -do apt-get install -y $packages --force-yes;apt-get -fy install;apt-get -y autoremove; done - -} - -function CheckAndDownloadFiles() -{ -echo "============================check files==================================" -if [ "$isinstallphp53" = "n" ]; then - if [ -s php-5.2.17.tar.gz ]; then - echo "php-5.2.17.tar.gz [found]" - else - echo "Error: php-5.2.17.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/php/php-5.2.17.tar.gz - fi - if [ -s php-5.2.17-fpm-0.5.14.diff.gz ]; then - echo "php-5.2.17-fpm-0.5.14.diff.gz [found]" - else - echo "Error: php-5.2.17-fpm-0.5.14.diff.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/phpfpm/php-5.2.17-fpm-0.5.14.diff.gz - fi -else - if [ -s php-5.3.28.tar.gz ]; then - echo "php-5.3.28.tar.gz [found]" - else - echo "Error: php-5.3.28.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/php/php-5.3.28.tar.gz - fi -fi - -if [ -s memcache-3.0.6.tgz ]; then - echo "memcache-3.0.6.tgz [found]" - else - echo "Error: memcache-3.0.6.tgz not found!!!download now......" - wget -c http://soft.vpser.net/web/memcache/memcache-3.0.6.tgz -fi - -if [ -s pcre-8.12.tar.gz ]; then - echo "pcre-8.12.tar.gz [found]" - else - echo "Error: pcre-8.12.tar.gz not found!!!download now......" -wget -c http://soft.vpser.net/web/pcre/pcre-8.12.tar.gz -fi - -if [ -s nginx-1.6.0.tar.gz ]; then - echo "nginx-1.6.0.tar.gz [found]" - else - echo "Error: nginx-1.6.0.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/nginx/nginx-1.6.0.tar.gz -fi - -if [ "$isinstallmysql55" = "n" ]; then - if [ -s mysql-5.1.73.tar.gz ]; then - echo "mysql-5.1.73.tar.gz [found]" - else - echo "Error: mysql-5.1.73.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/mysql/mysql-5.1.73.tar.gz - fi -elif [ "$isinstallmysql55" = "y" ]; then - if [ -s mysql-5.5.37.tar.gz ]; then - echo "mysql-5.5.37.tar.gz [found]" - else - echo "Error: mysql-5.5.37.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/mysql/mysql-5.5.37.tar.gz - fi -else - if [ -s mariadb-5.5.37.tar.gz ]; then - echo "mariadb-5.5.37.tar.gz [found]" - else - echo "Error: mariadb-5.5.37.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/mariadb/mariadb-5.5.37.tar.gz - fi -fi - -if [ -s libiconv-1.14.tar.gz ]; then - echo "libiconv-1.14.tar.gz [found]" - else - echo "Error: libiconv-1.14.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/libiconv/libiconv-1.14.tar.gz -fi - -if [ -s libmcrypt-2.5.8.tar.gz ]; then - echo "libmcrypt-2.5.8.tar.gz [found]" - else - echo "Error: libmcrypt-2.5.8.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/web/libmcrypt/libmcrypt-2.5.8.tar.gz -fi - -if [ "$isinstallphp53" = "n" ]; then - if [ -s phpmyadmin-latest.tar.gz ]; then - echo "phpmyadmin-latest.tar.gz [found]" - else - echo "Error: phpmyadmin-latest.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/phpmyadmin/phpmyadmin-latest.tar.gz - fi -else - if [ -s phpMyAdmin-lasest.tar.gz ]; then - echo "phpMyAdmin-lasest.tar.gz [found]" - else - echo "Error: phpMyAdmin-lasest.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/datebase/phpmyadmin/phpMyAdmin-lasest.tar.gz - fi -fi - -if [ -s p.tar.gz ]; then - echo "p.tar.gz [found]" - else - echo "Error: p.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/prober/p.tar.gz -fi - -if [ -s autoconf-2.13.tar.gz ]; then - echo "autoconf-2.13.tar.gz [found]" - else - echo "Error: autoconf-2.13.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/lib/autoconf/autoconf-2.13.tar.gz -fi - -if [ -s libxml2-2.7.8.tar.gz ]; then - echo "libxml2-2.7.8.tar.gz [found]" - else - echo "Error: libxml2-2.7.8.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/lib/libxml/libxml2-2.7.8.tar.gz -fi - -if [ -s mysql-openssl.patch ]; then - echo "mysql-openssl.patch [found]" - else - echo "Error: mysql-openssl.patch not found!!!download now......" - wget -c http://soft.vpser.net/lnmp/ext/mysql-openssl.patch -fi - -if [ -s freetype-2.4.12.tar.gz ]; then - echo "freetype-2.4.12.tar.gz [found]" - else - echo "Error: freetype-2.4.12.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/lib/freetype/freetype-2.4.12.tar.gz -fi -echo "============================check files==================================" -} - -function InstallDependsAndOpt() -{ -cd $cur_dir - -tar zxf autoconf-2.13.tar.gz -cd autoconf-2.13/ -./configure --prefix=/usr/local/autoconf-2.13 -make && make install -cd ../ - -cd $cur_dir -tar zxf libiconv-1.14.tar.gz -cd libiconv-1.14/ -./configure -make && make install -cd ../ - -cd $cur_dir -tar zxf libmcrypt-2.5.8.tar.gz -cd libmcrypt-2.5.8/ -./configure -make && make install -/sbin/ldconfig -cd libltdl/ -./configure --enable-ltdl-install -make && make install -cd ../../ - -ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.la -ln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.so -ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4 -ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.8 - -cd $cur_dir -tar zxf libxml2-2.7.8.tar.gz -cd libxml2-2.7.8/ -./configure --prefix=/usr -make && make install -cd ../ - -cd $cur_dir -tar zxf freetype-2.4.12.tar.gz -cd freetype-2.4.12/ -./configure --prefix=/usr/local/freetype -make && make install -cd ../ -cat > /etc/ld.so.conf.d/freetype.conf<> /etc/ld.so.conf -fi - -if [ ! `grep -l '/usr/lib' '/etc/ld.so.conf'` ]; then - echo "/usr/lib" >> /etc/ld.so.conf -fi - -if [ -d "/usr/lib64" ] && [ ! `grep -l '/usr/lib64' '/etc/ld.so.conf'` ]; then - echo "/usr/lib64" >> /etc/ld.so.conf -fi - -if [ ! `grep -l '/usr/local/lib' '/etc/ld.so.conf'` ]; then - echo "/usr/local/lib" >> /etc/ld.so.conf -fi - -ldconfig - -cat >>/etc/security/limits.conf<> /etc/sysctl.conf -} - -function InstallMySQL51() -{ -echo "============================Install MySQL 5.1.73==================================" -cd $cur_dir -rm -f /etc/my.cnf -rm -f /etc/mysql/my.cnf -rm -rf /etc/mysql/ -apt-get remove -y mysql-server -apt-get remove -y mysql-common mysql-client - -cd $cur_dir -tar zxf mysql-5.1.73.tar.gz -cd mysql-5.1.73/ -if [ $installinnodb = "y" ]; then -./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase -else -./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile -fi -cat Makefile | sed '/set -ex;/,/done/d' > Makefile.1 -rm Makefile -mv Makefile.1 Makefile -make && make install -cd ../ - -groupadd mysql -useradd -s /sbin/nologin -g mysql mysql -cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf -sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf -if [ $installinnodb = "y" ]; then -sed -i 's:#innodb:innodb:g' /etc/my.cnf -fi - -/usr/local/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql -ln -s /usr/local/mysql/share/mysql /usr/share/ - -chown -R mysql /usr/local/mysql/var -chgrp -R mysql /usr/local/mysql/. -cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysql -chmod 755 /etc/init.d/mysql - -cat > /etc/ld.so.conf.d/mysql.conf< /tmp/mysql_sec_script< /etc/ld.so.conf.d/mysql.conf< /tmp/mysql_sec_script< /etc/ld.so.conf.d/mariadb.conf< /tmp/mariadb_sec_script<>/usr/local/php/etc/php.ini<>/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf</home/wwwroot/default/phpinfo.php< -eof - -echo "======================= phpMyAdmin install ============================" -cd $cur_dir -#phpmyadmin -if [ "$isinstallphp53" = "n" ]; then - tar zxf phpmyadmin-latest.tar.gz - mv phpMyAdmin-3.4.8-all-languages /home/wwwroot/default/phpmyadmin -else - tar zxf phpMyAdmin-lasest.tar.gz - mv phpMyAdmin-*-all-languages /home/wwwroot/default/phpmyadmin -fi -cp conf/config.inc.php /home/wwwroot/default/phpmyadmin/config.inc.php -sed -i 's/LNMPORG/LNMP.org'$RANDOM'VPSer.net/g' /home/wwwroot/default/phpmyadmin/config.inc.php -mkdir /home/wwwroot/default/phpmyadmin/upload/ -mkdir /home/wwwroot/default/phpmyadmin/save/ -chmod 755 -R /home/wwwroot/default/phpmyadmin/ -chown www:www -R /home/wwwroot/default/phpmyadmin/ -echo "==================== phpMyAdmin install completed ======================" - -echo "Copy PHP Prober..." -tar zxvf p.tar.gz -cp p.php /home/wwwroot/default/p.php - -cp conf/index.html /home/wwwroot/default/index.html -} - -function AddAndStartup() -{ -echo "============================add nginx and php-fpm on startup============================" -echo "Download new nginx init.d file......" -wget -c http://soft.vpser.net/lnmp/ext/init.d.nginx -cp init.d.nginx /etc/init.d/nginx -chmod +x /etc/init.d/nginx -if [ "$isinstallmysql55" = "md" ]; then - update-rc.d -f mariadb defaults -else - update-rc.d -f mysql defaults -fi -update-rc.d -f nginx defaults -update-rc.d -f php-fpm defaults - -cd $cur_dir -cp vhost.sh /root/vhost.sh -chmod +x /root/vhost.sh - -if [ "$isinstallmysql55" = "md" ]; then - sed -i 's:/etc/init.d/mysql:/etc/init.d/mariadb:g' /root/lnmp -fi -echo "===========================add nginx and php-fpm on startup completed====================" -echo "Starting LNMP..." -if [ "$isinstallmysql55" = "md" ]; then - /etc/init.d/mariadb start -else - /etc/init.d/mysql start -fi -/etc/init.d/php-fpm start -/etc/init.d/nginx start - -#add iptables firewall rules -if [ -s /sbin/iptables ]; then -/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT -/sbin/iptables -I INPUT -p tcp --dport 3306 -j DROP -/sbin/iptables-save -fi -} - -function CheckInstall() -{ -echo "===================================== Check install ===================================" -clear -isnginx="" -ismysql="" -isphp="" -echo "Checking..." -if [ -s /usr/local/nginx/conf/nginx.conf ] && [ -s /usr/local/nginx/sbin/nginx ]; then - echo "Nginx: OK" - isnginx="ok" - else - echo "Error: /usr/local/nginx not found!!!Nginx install failed." -fi - -if [ "$isinstallmysql55" = "md" ]; then - if [ -s /usr/local/mariadb/bin/mysql ] && [ -s /usr/local/mariadb/bin/mysqld_safe ] && [ -s /etc/my.cnf ]; then - echo "MariaDB: OK" - ismysql="ok" - else - echo "Error: /usr/local/mariadb not found!!!MySQL install failed." - fi -else - if [ -s /usr/local/mysql/bin/mysql ] && [ -s /usr/local/mysql/bin/mysqld_safe ] && [ -s /etc/my.cnf ]; then - echo "MySQL: OK" - ismysql="ok" - else - echo "Error: /usr/local/mysql not found!!!MySQL install failed." - fi -fi - -if [ -s /usr/local/php/sbin/php-fpm ] && [ -s /usr/local/php/etc/php.ini ] && [ -s /usr/local/php/bin/php ]; then - echo "PHP: OK" - echo "PHP-FPM: OK" - isphp="ok" - else - echo "Error: /usr/local/php not found!!!PHP install failed." -fi -if [ "$isnginx" = "ok" ] && [ "$ismysql" = "ok" ] && [ "$isphp" = "ok" ]; then -echo "Install lnmp 1.1 completed! enjoy it." -echo "=========================================================================" -echo "LNMP V1.1 for Ubuntu Linux Server, Written by Licess " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "lnmp status manage: /root/lnmp {start|stop|reload|restart|kill|status}" -echo "default mysql root password:$mysqlrootpwd" -echo "phpinfo : http://yourIP/phpinfo.php" -echo "phpMyAdmin : http://yourIP/phpmyadmin/" -echo "Prober : http://yourIP/p.php" -echo "Add VirtualHost : /root/vhost.sh" -echo "" -echo "The path of some dirs:" -echo "mysql dir: /usr/local/mysql" -echo "php dir: /usr/local/php" -echo "nginx dir: /usr/local/nginx" -echo "web dir : /home/wwwroot/default" -echo "" -echo "=========================================================================" -/root/lnmp status -netstat -ntl -else -echo "Sorry,Failed to install LNMP!" -echo "Please visit http://bbs.vpser.net/forum-25-1.html feedback errors and logs." -echo "You can download /root/lnmp-install.log from your server,and upload lnmp-install.log to LNMP Forum." -fi -} - -InitInstall 2>&1 | tee /root/lnmp-install.log -CheckAndDownloadFiles 2>&1 | tee -a /root/lnmp-install.log -InstallDependsAndOpt 2>&1 | tee -a /root/lnmp-install.log -if [ "$isinstallmysql55" = "n" ]; then - InstallMySQL51 2>&1 | tee -a /root/lnmp-install.log -elif [ "$isinstallmysql55" = "y" ]; then - InstallMySQL55 2>&1 | tee -a /root/lnmp-install.log -else - InstallMariaDB 2>&1 | tee -a /root/lnmp-install.log -fi -if [ "$isinstallphp53" = "n" ]; then - InstallPHP52 2>&1 | tee -a /root/lnmp-install.log -else - InstallPHP53 2>&1 | tee -a /root/lnmp-install.log -fi -InstallNginx 2>&1 | tee -a /root/lnmp-install.log -CreatPHPTools 2>&1 | tee -a /root/lnmp-install.log -AddAndStartup 2>&1 | tee -a /root/lnmp-install.log -CheckInstall 2>&1 | tee -a /root/lnmp-install.log \ No newline at end of file diff --git a/uninstall.sh b/uninstall.sh index 131e7a0c..beaf1581 100644 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,170 +1,165 @@ #!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH # Check if user is root if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, use sudo sh $0" + echo "Error: You must be root to run this script, please use root to install lnmp" exit 1 fi -clear -echo "=========================================================================" -echo "Uninstall LNMP or LNMPA, Written by Licess" -echo "=========================================================================" -echo "A tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "" -echo "For more information please visit http:/www.lnmp.org/" -echo "" -echo 'Please backup your mysql data and configure files first!!!!!' -echo "" -echo "=========================================================================" +cur_dir=$(pwd) +Stack=$1 + +LNMP_Ver='1.2' + +. include/main.sh + shopt -s extglob -if [ -s /usr/local/mariadb/bin/mysql ]; then - ismysql="no" -else - ismysql="yes" -fi -echo "" - uninstall="" - echo "INPUT 1 to uninstall LNMP" - echo "INPUT 2 to uninstall LNMPA" - read -p "(Please input 1 or 2):" uninstall - - case "$uninstall" in - 1) - echo "You will uninstall LNMP" - echo -e "\033[31mPlease backup your configure files and mysql data!!!!!!\033[0m" - echo 'The following directory or files will be remove!' - cat << EOF -/usr/local/php +Check_DB +Get_OS_Bit +Get_Dist_Name + +clear +echo "+------------------------------------------------------------------------+" +echo "| LNMP V${LNMP_Ver} for ${DISTRO} Linux Server, Written by Licess |" +echo "+------------------------------------------------------------------------+" +echo "| A tool to auto-compile & install Nginx+MySQL+PHP on Linux |" +echo "+------------------------------------------------------------------------+" +echo "| For more information please visit http://www.lnmp.org |" +echo "+------------------------------------------------------------------------+" + +Uninstall_LNMP() +{ + echo "Stoping LNMP..." + lnmp stop + + Remove_StartUp nginx + Remove_StartUp ${DB_Name} + Remove_StartUp php-fpm + echo "Deleting LNMP files..." + rm -rf /usr/local/nginx + rm -rf /usr/local/${DB_Name}/!(var|data) + rm -rf /usr/local/php + rm -rf /usr/local/zend + + rm -f /etc/my.cnf + rm -f /etc/init.d/nginx + rm -f /etc/init.d/${DB_Name} + rm -f /etc/init.d/php-fpm + rm -f /bin/lnmp + echo "LNMP Uninstall completed." +} + +Uninstall_LNMPA() +{ + echo "Stoping LNMPA..." + lnmp stop + + Remove_StartUp nginx + Remove_StartUp ${DB_Name} + Remove_StartUp httpd + echo "Deleting LNMPA files..." + rm -rf /usr/local/nginx + rm -rf /usr/local/${DB_Name}/!(var|data) + rm -rf /usr/local/php + rm -rf /usr/local/apache + rm -rf /usr/local/zend + + rm -f /etc/my.cnf + rm -f /etc/init.d/nginx + rm -f /etc/init.d/${DB_Name} + rm -f /etc/init.d/httpd + rm -f /bin/lnmp + echo "LNMPA Uninstall completed." +} + +Uninstall_LAMP() +{ + echo "Stoping LAMP..." + lnmp stop + + Remove_StartUp httpd + Remove_StartUp ${DB_Name} + echo "Deleting LAMP files..." + rm -rf /usr/local/apache + rm -rf /usr/local/php + rm -rf /usr/local/${DB_Name}/!(var|data) + rm -rf /usr/local/zend + + rm -f /etc/my.cnf + rm -f /etc/init.d/httpd + rm -f /etc/init.d/${DB_Name} + rm -f /bin/lnmp + echo "LAMP Uninstall completed." +} + + Check_Stack + echo "Current Stack: ${Get_Stack}" + + action="" + echo "Enter 1 to uninstall LNMP" + echo "Enter 2 to uninstall LNMPA" + echo "Enter 2 to uninstall LAMP" + read -p "(Please input 1, 2 or 3):" action + + case "$action" in + 1|[lL][nN][nM][pP]) + echo "You will uninstall LNMP" + Echo_Red "Please backup your configure files and mysql data!!!!!!" + Echo_Red "The following directory or files will be remove!" + cat << EOF /usr/local/nginx -/usr/local/mysql +${MySQL_Dir} +/usr/local/php +/etc/init.d/nginx +/etc/init.d/${DB_Name} +/etc/init.d/php-fpm /usr/local/zend /etc/my.cnf -/root/vhost.sh -/root/lnmp -/root/run.sh -/etc/init.d/php-fpm -/etc/init.d/nginx -/etc/init.d/mysql +/bin/lnmp EOF - ;; - 2) - echo "You will uninstall LNMPA" - echo -e "\033[31mPlease backup your configure files and mysql data!!!!!!\033[0m" - echo 'The following directory or files will be remove!' - cat << EOF -/usr/local/php + sleep 3 + Press_Start + Uninstall_LNMP + ;; + 2|[lL][nN][nM][pP][aA]) + echo "You will uninstall LNMPA" + Echo_Red "Please backup your configure files and mysql data!!!!!!" + Echo_Red "The following directory or files will be remove!" + cat << EOF /usr/local/nginx -/usr/local/mysql -/usr/local/zend +${MySQL_Dir} +/usr/local/php /usr/local/apache -/etc/my.cnf -/root/vhost.sh -/root/lnmp -/root/run.sh -/etc/init.d/php-fpm /etc/init.d/nginx -/etc/init.d/mysql +/etc/init.d/${DB_Name} /etc/init.d/httpd +/usr/local/zend +/etc/my.cnf +/bin/lnmp EOF - esac - - echo -e "\033[31mPlease backup your configure files and mysql data!!!!!!\033[0m" - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start uninstall or Press Ctrl+c to cancel" - char=`get_char` - -function uninstall_lnmp -{ - /etc/init.d/nginx stop - if [ "$ismysql" = "no" ]; then - /etc/init.d/mariadb stop - else - /etc/init.d/mysql stop - fi - /etc/init.d/php-fpm stop - - rm -rf /usr/local/php - rm -rf /usr/local/nginx - if [ "$ismysql" = "no" ]; then - rm -rf /usr/local/mariadb/!(var|data) - else - rm -rf /usr/local/mysql/!(var|data) - fi - rm -rf /usr/local/zend - - rm -f /etc/my.cnf - rm -f /root/vhost.sh - rm -f /root/lnmp - rm -f /root/run.sh - rm -f /etc/init.d/php-fpm - rm -f /etc/init.d/nginx - if [ "$ismysql" = "no" ]; then - rm -f /etc/init.d/mariadb - else - rm -f /etc/init.d/mysql - fi - echo "LNMP Uninstall completed." -} - -function uninstall_lnmpa -{ - /etc/init.d/nginx stop - if [ "$ismysql" = "no" ]; then - /etc/init.d/mariadb stop - else - /etc/init.d/mysql stop - fi - /etc/init.d/php-fpm stop - - rm -rf /usr/local/php - rm -rf /usr/local/nginx - if [ "$ismysql" = "no" ]; then - rm -rf /usr/local/mariadb/!(var|data) - else - rm -rf /usr/local/mysql/!(var|data) - fi - rm -rf /usr/local/zend - rm -rf /usr/local/apache - - rm -f /etc/my.cnf - rm -f /root/vhost.sh - rm -f /root/lnmp - rm -f /root/run.sh - rm -f /etc/init.d/php-fpm - rm -f /etc/init.d/nginx - if [ "$ismysql" = "no" ]; then - rm -f /etc/init.d/mariadb - else - rm -f /etc/init.d/mysql - fi - rm -f /etc/init.d/httpd - echo "LNMPA Uninstall completed." -} - -if [ "$uninstall" = "1" ]; then - uninstall_lnmp -else - uninstall_lnmpa -fi - -echo "=========================================================================" -echo "Uninstall LNMP or LNMPA, Written by Licess" -echo "=========================================================================" -echo "A tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" \ No newline at end of file + sleep 3 + Press_Start + Uninstall_LNMPA + ;; + 3|[lL][aA][nM][pP]) + echo "You will uninstall LAMP" + Echo_Red "Please backup your configure files and mysql data!!!!!!" + Echo_Red "The following directory or files will be remove!" + cat << EOF +/usr/local/apache +${MySQL_Dir} +/etc/init.d/httpd +/etc/init.d/${DB_Name} +/usr/local/php +/usr/local/zend +/etc/my.cnf +/bin/lnmp +EOF + sleep 3 + Press_Start + Uninstall_LAMP + ;; + esac diff --git a/upgrade.sh b/upgrade.sh new file mode 100644 index 00000000..847edb08 --- /dev/null +++ b/upgrade.sh @@ -0,0 +1,81 @@ +#!/bin/bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +# Check if user is root +if [ $(id -u) != "0" ]; then + echo "Error: You must be root to run this script" + exit 1 +fi + +cur_dir=$(pwd) +Download_Mirror='http://soft.vpser.net' +action=$1 +shopt -s extglob +Upgrade_Date=$(date +"%Y%m%d%H%M%S") + +. include/main.sh +. include/init.sh +. include/upgrade_nginx.sh +. include/upgrade_php.sh +. include/upgrade_mysql.sh +. include/upgrade_mariadb.sh +. include/upgrade_mysql2mariadb.sh + +Get_Dist_Name +Get_OS_Bit + +Display_Upgrade_Menu() +{ + echo "1: Upgrade Nginx" + echo "2: Upgrade MySQL" + echo "3: Upgrade MariaDB" + echo "4: Upgrade PHP for LNMP" + echo "5: Upgrade PHP for LNMPA or LAMP" + echo "6: Upgrade MySQL to MariaDB" + echo "exit: Exit current script" + echo "###################################################" + read -p "Enter your choice (1, 2, 3, 4, 5, 6 or exit): " action +} + +clear +echo "+-----------------------------------------------------------------------+" +echo "| Upgrade script for LNMP V1.2, Written by Licess |" +echo "+-----------------------------------------------------------------------+" +echo "| A tool to upgrade Nginx,MySQL/Mariadb,PHP for LNMP/LNMPA/LAMP |" +echo "+-----------------------------------------------------------------------+" +echo "| For more information please visit http://www.lnmp.org |" +echo "+-----------------------------------------------------------------------+" + +if [ "${action}" == "" ]; then + Display_Upgrade_Menu +fi + + case "${action}" in + 1|[nN][gG][iI][nN][xX]) + Upgrade_Nginx 2>&1 | tee /root/upgrade_nginx${Upgrade_Date}.log + ;; + 2|[mM][yY][sS][qQ][lL]) + Upgrade_MySQL 2>&1 | tee /root/upgradel_mysq${Upgrade_Date}.log + ;; + 3|[mM][aA][rR][iI][aA][dD][bB]) + Upgrade_MariaDB 2>&1 | tee /root/upgrade_mariadb${Upgrade_Date}.log + ;; + 4|[pP][hP][pP]) + Stack="lnmp" + Upgrade_PHP 2>&1 | tee /root/upgrade_lnmp_php${Upgrade_Date}.log + ;; + 5|[pP][hP][pP][aA]) + Upgrade_PHP 2>&1 | tee /root/upgrade_a_php${Upgrade_Date}.log + ;; + 6|[mM]2[mY]) + Upgrade_MySQL2MariaDB 2>&1 | tee /root/upgrade_mysql2mariadb${Upgrade_Date}.log + ;; + [eE][xX][iI][tT]) + exit 1 + ;; + *) + echo "Usage: ./upgrade.sh {nginx|mysql|mariadb|m2m|php|phpa}" + exit 1 + ;; + esac \ No newline at end of file diff --git a/upgrade_lnmpa_php.sh b/upgrade_lnmpa_php.sh deleted file mode 100644 index 81ac6b53..00000000 --- a/upgrade_lnmpa_php.sh +++ /dev/null @@ -1,221 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=========================================================================" -echo "Upgrade PHP for LNMPA, Written by Licess" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "=========================================================================" -cur_dir=$(pwd) - -if [ "$1" != "--help" ]; then - -old_php_version=`/usr/local/php/bin/php -r 'echo PHP_VERSION;'` -#echo $old_php_version -if [ -s /usr/local/mariadb/bin/mysql ]; then - ismysql="no" -else - ismysql="yes" -fi - -#set php version - - php_version="" - echo "Current PHP Version:$old_php_version" - echo "You can get version number from http://www.php.net/" - read -p "(Please input PHP Version you want):" php_version - if [ "$php_version" = "" ]; then - echo "Error: You must input php version!!" - exit 1 - fi - - if [ "$php_version" = "$old_php_version" ]; then - echo "Error: The upgrade PHP Version is the same as the old Version!!" - exit 1 - fi - echo "===========================" - - echo "You want to upgrade php version to $php_version" - - echo "===========================" - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "============================check files==================================" -if [ -s php-$php_version.tar.gz ]; then - echo "php-$php_version.tar.gz [found]" - else - echo "Error: php-$php_version.tar.gz not found!!!download now......" - wget -c http://www.php.net/distributions/php-$php_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download php-$php_version.tar.gz successfully!" - else - wget -c http://museum.php.net/php5/php-$php_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download php-$php_version.tar.gz successfully!" - else - echo "WARNING!May be the php version you input was wrong,please check!" - echo "PHP Version input was:"$php_version - sleep 5 - exit 1 - fi - fi -fi -echo "============================check files==================================" - -#Backup old php version configure files -echo "Backup old php version configure files......" -/etc/init.d/httpd stop -mkdir -p /root/phpconf -cp /usr/local/php/etc/php.ini /root/phpconf/php.ini.old.bak -rm -rf /usr/local/php/ -mv /usr/local/apache/modules/libphp5.so /root/phpconf/ -rm -f /usr/local/apache/modules/libphp5.so - -echo "Stoping Nginx..." -/etc/init.d/nginx stop -if [ "$ismysql" = "no" ]; then - echo "Stoping MariaDB..." - /etc/init.d/mariadb stop -else - echo "Stoping MySQL..." - /etc/init.d/mysql stop -fi -echo "Stoping Apache..." -/etc/init.d/httpd stop -if [ -s /etc/init.d/memceached ]; then - echo "Stoping Memcached..." - /etc/init.d/memcacehd stop -fi - -cd $cur_dir -echo "Starting install php......" -if [ -s php-$php_version/ ]; then -rm -rf php-$php_version/ -fi -tar zxvf php-$php_version.tar.gz -cd php-$php_version/ -./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo - -rm -f libtool -cp /usr/local/apache/build/libtool . - -if [[ "$php_version" =~ "5.4." ]] || [[ "$php_version" =~ "5.5." ]]; then - sed -i 's/preserve-dup-deps/& --tag=CC/' Makefile -fi - -make ZEND_EXTRA_LIBS='-liconv' -make install - -mkdir -p /usr/local/php/etc/ -rm -f /usr/local/php/etc/php.ini -cp php.ini-production /usr/local/php/etc/php.ini - -cd $cur_dir -# php extensions -echo "Modify php.ini......" -sed -i 's/post_max_size = 8M/post_max_size = 50M/g' /usr/local/php/etc/php.ini -sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini -sed -i 's/;date.timezone =/date.timezone = PRC/g' /usr/local/php/etc/php.ini -sed -i 's/short_open_tag = Off/short_open_tag = On/g' /usr/local/php/etc/php.ini -sed -i 's/; cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini -sed -i 's/max_execution_time = 30/max_execution_time = 300/g' /usr/local/php/etc/php.ini -sed -i 's/register_long_arrays = On/;register_long_arrays = On/g' /usr/local/php/etc/php.ini -sed -i 's/magic_quotes_gpc = On/;magic_quotes_gpc = On/g' /usr/local/php/etc/php.ini -sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,scandir,chgrp,chown,shell_exec,proc_open,proc_get_status,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server,fsocket/g' /usr/local/php/etc/php.ini - -echo "Install ZendGuardLoader for PHP..." -if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then - if [[ "$php_version" =~ "5.3." ]]; then - wget -c http://soft.vpser.net/web/zend/ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz - tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz - mkdir -p /usr/local/zend/ - \cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so /usr/local/zend/ - elif [[ "$php_version" =~ "5.4." ]]; then - wget -c http://soft.vpser.net/web/zend/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz - tar zxvf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64.tar.gz - mkdir -p /usr/local/zend/ - \cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-x86_64/php-5.4.x/ZendGuardLoader.so /usr/local/zend/ - elif [[ "$php_version" =~ "5.5." ]]; then - echo "Current PHP 5.5.* DO NOT SUPPORT Zend Guard Loader!" - fi -else - if [[ "$php_version" =~ "5.3." ]]; then - wget -c http://soft.vpser.net/web/zend/ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz - tar zxvf ZendGuardLoader-php-5.3-linux-glibc23-i386.tar.gz - mkdir -p /usr/local/zend/ - \cp ZendGuardLoader-php-5.3-linux-glibc23-i386/php-5.3.x/ZendGuardLoader.so /usr/local/zend/ - elif [[ "$php_version" =~ "5.4." ]]; then - wget -c http://soft.vpser.net/web/zend/ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz - tar zxvf ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386.tar.gz - mkdir -p /usr/local/zend/ - \cp ZendGuardLoader-70429-PHP-5.4-linux-glibc23-i386/php-5.4.x/ZendGuardLoader.so /usr/local/zend/ - elif [[ "$php_version" =~ "5.5." ]]; then - echo "Current PHP 5.5.* DO NOT SUPPORT Zend Guard Loader!" - fi -fi - -echo "Write ZendGuardLoader to php.ini......" -cat >>/usr/local/php/etc/php.ini<testmariadbrootpassword.sql< /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "============================check files==================================" -if [ -s mariadb-$mariadb_version.tar.gz ]; then - echo "mariadb-$mariadb_version.tar.gz [found]" - else - echo "Error: mariadb-$mariadb_version.tar.gz not found!!!download now......" - wget -c https://downloads.mariadb.org/interstitial/mariadb-$mariadb_version/kvm-tarbake-jaunty-x86/mariadb-$mariadb_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download mariadb-$mariadb_version.tar.gz successfully!" - else - wget -c https://downloads.mariadb.org/interstitial/mariadb-$mariadb_version/source/mariadb-$mariadb_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download mariadb-$mariadb_version.tar.gz successfully!" - else - echo "WARNING!May be the MariaDB Version you input was wrong,please check!" - echo "MariaDB Version input was:"$mariadb_version - sleep 5 - exit 1 - fi - fi -fi -echo "============================check files==================================" - -function stopall { - echo "Stoping Nginx..." - /etc/init.d/nginx stop - if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then - echo "Stoping Apache......" - /etc/init.d/httpd -k stop - else - echo "Stoping php-fpm......" - /etc/init.d/php-fpm stop - fi - if [ -s /etc/init.d/memceached ]; then - echo "Stoping Memcached..." - /etc/init.d/memcacehd stop - fi -} - -function backup_mysql { - echo "Starting backup all databases..." - echo "If the database is large, the backup time will be longer." - /usr/local/mariadb/bin/mysqldump -uroot -p$mariadb_root_password --all-databases > /root/mysql_all_backup$(date +"%Y%m%d").sql - if [ $? -eq 0 ]; then - echo "MariaDB databases backup successfully."; - else - echo "MariaDB databases backup failed,Please backup databases manually!" - exit 1 - fi - echo "Stoping MariaDB..." - /etc/init.d/mariadb stop - mv /etc/init.d/mariadb /etc/init.d/mariadb.bak.$upgrade_date - mv /etc/my.cnf /etc/my.conf.mariadbbak.$upgrade_date -} - -function upgrade_mariadb { - echo "Starting upgrade MariaDB..." - cd $cur_dir - - rm -rf mariadb-$mariadb_version - rm -f /etc/my.cnf - tar zxf mariadb-$mariadb_version.tar.gz - cd mariadb-$mariadb_version/ - cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 - make && make install - - groupadd mariadb - useradd -s /sbin/nologin -M -g mariadb mariadb - - cp support-files/my-medium.cnf /etc/my.cnf - sed '/skip-external-locking/i\pid-file = /usr/local/mariadb/var/mariadb.pid' -i /etc/my.cnf - sed '/skip-external-locking/i\log_error = /usr/local/mariadb/var/mariadb.err' -i /etc/my.cnf - sed '/skip-external-locking/i\basedir = /usr/local/mariadb' -i /etc/my.cnf - sed '/skip-external-locking/i\datadir = /usr/local/mariadb/var' -i /etc/my.cnf - sed '/skip-external-locking/i\user = mariadb' -i /etc/my.cnf - if [ $installinnodb = "y" ]; then - sed -i 's:#innodb:innodb:g' /etc/my.cnf - sed -i 's:/usr/local/mariadb/data:/usr/local/mariadb/var:g' /etc/my.cnf - else - sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf - fi - -cat > /etc/ld.so.conf.d/mariadb.conf<&1 | tee -a /root/mariadb_upgrade$upgrade_date.log - -backup_mysql 2>&1 | tee -a /root/mariadb_upgrade$upgrade_date.log - -upgrade_mariadb 2>&1 | tee -a /root/mariadb_upgrade$upgrade_date.log - -startall 2>&1 | tee -a /root/mariadb_upgrade$upgrade_date.log - -echo "=========================================================================" -echo "You have successfully upgrade MariaDB from $old_mariadb_version to $mariadb_version" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" \ No newline at end of file diff --git a/upgrade_mysql.sh b/upgrade_mysql.sh deleted file mode 100644 index 4c95223b..00000000 --- a/upgrade_mysql.sh +++ /dev/null @@ -1,363 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=========================================================================" -echo "Upgrade MySQL for LNMP, Written by Licess" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "=========================================================================" -cur_dir=$(pwd) -upgrade_date=$(date +"%Y%m%d") -shopt -s extglob - -old_mysql_version=`/usr/local/mysql/bin/mysql -V | awk '{print $5}' | tr -d ","` -#echo $old_mysql_version - - - read -p "Please input your MySQL root password:" mysql_root_password -cat >testmysqlrootpassword.sql< /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "============================check files==================================" -if [ -s mysql-$mysql_version.tar.gz ]; then - echo "mysql-$mysql_version.tar.gz [found]" - else - echo "Error: mysql-$mysql_version.tar.gz not found!!!download now......" - wget -c http://cdn.mysql.com/Downloads/MySQL-$mysql_short_version/mysql-$mysql_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download mysql-$mysql_version.tar.gz successfully!" - else - echo "WARNING!May be the MySQL Version you input was wrong,please check!" - echo "MySQL Version input was:"$mysql_version - sleep 5 - exit 1 - fi -fi -echo "============================check files==================================" - -function stopall { - echo "Stoping Nginx..." - /etc/init.d/nginx stop - if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then - echo "Stoping Apache......" - /etc/init.d/httpd -k stop - else - echo "Stoping php-fpm......" - /etc/init.d/php-fpm stop - fi - if [ -s /etc/init.d/memceached ]; then - echo "Stoping Memcached..." - /etc/init.d/memcacehd stop - fi -} - -function backup_mysql { - echo "Starting backup all databases..." - echo "If the database is large, the backup time will be longer." - /usr/local/mysql/bin/mysqldump -uroot -p$mysql_root_password --all-databases > /root/mysql_all_backup$(date +"%Y%m%d").sql - if [ $? -eq 0 ]; then - echo "MySQL databases backup successfully."; - else - echo "MySQL databases backup failed,Please backup databases manually!" - exit 1 - fi - echo "Stoping MySQL..." - /etc/init.d/mysql stop - mv /etc/init.d/mysql /etc/init.d/mysql.bak.$upgrade_date - mv /etc/my.cnf /etc/my.conf.bak.$upgrade_date - rm -rf /usr/local/mysql/!(var|data) -} - -function upgrade_mysql51 { - cd $cur_dir - rm -f /etc/my.cnf - rm -rf mysql-$mysql_version/ - - tar zxf mysql-$mysql_version.tar.gz - cd mysql-$mysql_version/ - if [ $installinnodb = "y" ]; then - ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile --with-plugins=innobase - else - ./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-thread-safe-client --enable-assembler --with-mysqld-ldflags=-all-static --with-charset=utf8 --enable-thread-safe-client --with-big-tables --with-readline --with-ssl --with-embedded-server --enable-local-infile - fi - cat Makefile | sed '/set -ex;/,/done/d' > Makefile.1 - rm Makefile - mv Makefile.1 Makefile - make && make install - cd ../ - - groupadd mysql - useradd -s /sbin/nologin -g mysql mysql - cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf - sed -i 's/skip-locking/skip-external-locking/g' /etc/my.cnf - if [ $installinnodb = "y" ]; then - sed -i 's:#innodb:innodb:g' /etc/my.cnf - sed -i 's:/usr/local/mysql/data:/usr/local/mysql/var:g' /etc/my.cnf - else - sed '/skip-external-locking/i\nloose-skip-innodb' -i /etc/my.cnf - fi -} - -function upgrade_mysql55 { - echo "Starting upgrade MySQL..." - cat /etc/issue | grep -Eqi '(Debian|Ubuntu)' && apt-get update;apt-get install cmake -y || yum -y install cmake - rm -rf mysql-$mysql_version/ - wget -c http://soft.vpser.net/lnmp/ext/mysql-openssl.patch - - tar zxf mysql-$mysql_version.tar.gz - cd mysql-$mysql_version/ - patch -p1 < $cur_dir/mysql-openssl.patch - cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 - make && make install - - groupadd mysql - useradd -s /sbin/nologin -M -g mysql mysql - - cp support-files/my-medium.cnf /etc/my.cnf - - sed '/skip-external-locking/i\datadir = /usr/local/mysql/var' -i /etc/my.cnf - if [ $installinnodb = "y" ]; then - sed -i 's:#innodb:innodb:g' /etc/my.cnf - sed -i 's:/usr/local/mysql/data:/usr/local/mysql/var:g' /etc/my.cnf - else - sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf - fi - -cat > /etc/ld.so.conf.d/mysql.conf< /etc/my.cnf< /etc/ld.so.conf.d/mysql.conf<&1 | tee -a /root/mysql_upgrade$upgrade_date.log - -backup_mysql 2>&1 | tee -a /root/mysql_upgrade$upgrade_date.log - -if [ $mysql_short_version = "5.1" ]; then - upgrade_mysql51 2>&1 | tee -a /root/mysql_upgrade$upgrade_date.log -elif [ $mysql_short_version = "5.5" ]; then - upgrade_mysql55 2>&1 | tee -a /root/mysql_upgrade$upgrade_date.log -elif [ $mysql_short_version = "5.6" ]; then - upgrade_mysql56 2>&1 | tee -a /root/mysql_upgrade$upgrade_date.log -fi - -startall 2>&1 | tee -a /root/mysql_upgrade$upgrade_date.log - -echo "=========================================================================" -echo "You have successfully upgrade from $old_mysql_version to $mysql_version" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" \ No newline at end of file diff --git a/upgrade_mysql2mariadb.sh b/upgrade_mysql2mariadb.sh deleted file mode 100644 index b2169572..00000000 --- a/upgrade_mysql2mariadb.sh +++ /dev/null @@ -1,279 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=========================================================================" -echo "Upgrade MySQL to MariaDB for LNMP, Written by Licess" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "=========================================================================" -cur_dir=$(pwd) -upgrade_date=$(date +"%Y%m%d") - -old_mysql_version=`/usr/local/mysql/bin/mysql -V | awk '{print $5}' | tr -d ","` -#echo $old_mysql_version - - - read -p "Please input your MYSQL root password:" mysql_root_password -cat >testmysqlrootpassword.sql< /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "============================check files==================================" -if [ -s mariadb-$mariadb_version.tar.gz ]; then - echo "mariadb-$mariadb_version.tar.gz [found]" - else - echo "Error: mariadb-$mariadb_version.tar.gz not found!!!download now......" - wget -c https://downloads.mariadb.org/interstitial/mariadb-$mariadb_version/kvm-tarbake-jaunty-x86/mariadb-$mariadb_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download mariadb-$mariadb_version.tar.gz successfully!" - else - wget -c https://downloads.mariadb.org/interstitial/mariadb-$mariadb_version/source/mariadb-$mariadb_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download mariadb-$mariadb_version.tar.gz successfully!" - else - echo "WARNING!May be the MariaDB Version you input was wrong,please check!" - echo "MariaDB Version input was:"$mariadb_version - sleep 5 - exit 1 - fi - fi -fi -echo "============================check files==================================" - -function stopall { - echo "Stoping Nginx..." - /etc/init.d/nginx stop - if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then - echo "Stoping Apache......" - /etc/init.d/httpd -k stop - else - echo "Stoping php-fpm......" - /etc/init.d/php-fpm stop - fi - if [ -s /etc/init.d/memceached ]; then - echo "Stoping Memcached..." - /etc/init.d/memcacehd stop - fi -} - -function backup_mysql { - echo "Starting backup all databases..." - echo "If the database is large, the backup time will be longer." - /usr/local/mysql/bin/mysqldump -uroot -p$mysql_root_password --all-databases > /root/mysql_all_backup$(date +"%Y%m%d").sql - if [ $? -eq 0 ]; then - echo "MariaDB databases backup successfully."; - else - echo "MariaDB databases backup failed,Please backup databases manually!" - exit 1 - fi - echo "Stoping MySQL..." - /etc/init.d/mysql stop - echo "Remove autostart..." - if [ -s /etc/debian_version ]; then - update-rc.d -f mysql remove - elif [ -s /etc/redhat-release ]; then - chkconfig mysql off - fi - mv /etc/init.d/mysql /etc/init.d/mysql2mariadb.bak.$upgrade_date - mv /etc/my.cnf /etc/my.conf.mysql2mariadbbak.$upgrade_date -} - -function upgrade2mariadb { - echo "Starting upgrade MySQL to MariaDB..." - cd $cur_dir - - rm -rf mariadb-$mariadb_version - rm -f /etc/my.cnf - tar zxf mariadb-$mariadb_version.tar.gz - cd mariadb-$mariadb_version/ - cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DWITH_ARIA_STORAGE_ENGINE=1 -DWITH_XTRADB_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_MYISAM_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_READLINE=1 -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_EMBEDDED_SERVER=1 -DENABLED_LOCAL_INFILE=1 - make && make install - - groupadd mariadb - useradd -s /sbin/nologin -M -g mariadb mariadb - - cp support-files/my-medium.cnf /etc/my.cnf - sed '/skip-external-locking/i\pid-file = /usr/local/mariadb/var/mariadb.pid' -i /etc/my.cnf - sed '/skip-external-locking/i\log_error = /usr/local/mariadb/var/mariadb.err' -i /etc/my.cnf - sed '/skip-external-locking/i\basedir = /usr/local/mariadb' -i /etc/my.cnf - sed '/skip-external-locking/i\datadir = /usr/local/mariadb/var' -i /etc/my.cnf - sed '/skip-external-locking/i\user = mariadb' -i /etc/my.cnf - if [ $installinnodb = "y" ]; then - sed -i 's:#innodb:innodb:g' /etc/my.cnf - sed -i 's:/usr/local/mariadb/data:/usr/local/mariadb/var:g' /etc/my.cnf - else - sed '/skip-external-locking/i\default-storage-engine=MyISAM\nloose-skip-innodb' -i /etc/my.cnf - fi - -cat > /etc/ld.so.conf.d/mariadb.conf< /tmp/mariadb_sec_script<&1 | tee -a /root/mysql2mariadb_upgrade$upgrade_date.log - -backup_mysql 2>&1 | tee -a /root/mysql2mariadb_upgrade$upgrade_date.log - -upgrade2mariadb 2>&1 | tee -a /root/mysql2mariadb_upgrade$upgrade_date.log - -startall 2>&1 | tee -a /root/mysql2mariadb_upgrade$upgrade_date.log - -echo "=========================================================================" -echo "You have successfully upgrade MySQL $old_mysql_version to MariaDB $mariadb_version" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" \ No newline at end of file diff --git a/upgrade_nginx.sh b/upgrade_nginx.sh deleted file mode 100644 index 94161e78..00000000 --- a/upgrade_nginx.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=========================================================================" -echo "Upgrade Nginx for LNMP, Written by Licess" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "=========================================================================" - -nv=`/usr/local/nginx/sbin/nginx -v 2>&1` -old_nginx_version=`echo $nv | cut -c22-` -#echo $old_nginx_version -if [ -s /usr/local/mariadb/bin/mysql ]; then - ismysql="no" -else - ismysql="yes" -fi - -if [ "$1" != "--help" ]; then - -#set nginx version - - nginx_version="" - echo "Current Nginx Version:$old_nginx_version" - echo "Please input nginx version you want:" - echo "You can get version number from http://nginx.org/en/download.html" - read -p "(example: 0.8.54 ):" nginx_version - if [ "$nginx_version" = "" ]; then - echo "Error: You must input nginx version!!" - exit 1 - fi - echo "===========================" - - echo "You want to upgrade nginx version to $nginx_version" - - echo "===========================" - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "============================check files==================================" -if [ -s nginx-$nginx_version.tar.gz ]; then - echo "nginx-$nginx_version.tar.gz [found]" - else - echo "Error: nginx-$nginx_version.tar.gz not found!!!download now......" - wget -c http://nginx.org/download/nginx-$nginx_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download nginx-$nginx_version.tar.gz successfully!" - else - echo "WARNING!May be the nginx version you input was wrong,please check!" - echo "Nginx Version input was:"$nginx_version - sleep 5 - exit 1 - fi -fi -echo "============================check files==================================" -if [ "$ismysql" = "no" ]; then - echo "Stoping MariaDB..." - /etc/init.d/mariadb stop -else - echo "Stoping MySQL..." - /etc/init.d/mysql stop -fi -echo "Stoping PHP-FPM..." -/etc/init.d/php-fpm stop -if [ -s /etc/init.d/memceached ]; then - echo "Stoping Memcached..." - /etc/init.d/memcacehd stop -fi - -rm -rf nginx-$nginx_version/ - -tar zxvf nginx-$nginx_version.tar.gz -cd nginx-$nginx_version/ -./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 -make - -mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old -cp objs/nginx /usr/local/nginx/sbin/nginx -/usr/local/nginx/sbin/nginx -t -make upgrade -echo "Upgrade completed!" -echo "Program will display Nginx Version......" -/usr/local/nginx/sbin/nginx -v -cd ../ - -echo "Restarting Nginx..." -/etc/init.d/nginx restart - -if [ "$ismysql" = "no" ]; then - echo "Starting MariaDB..." - /etc/init.d/mariadb start -else - echo "Starting MySQL..." - /etc/init.d/mysql start -fi -if [ -s /etc/init.d/httpd ] && [ -s /usr/local/apache ]; then -echo "Restarting Apache......" -/etc/init.d/httpd -k restart -else -echo "Restarting php-fpm......" -/etc/init.d/php-fpm restart -fi -if [ -s /etc/init.d/memceached ]; then - echo "Starting Memcached..." - /etc/init.d/memcacehd start -fi - -echo "=========================================================================" -echo "You have successfully upgrade from $old_nginx_version to $nginx_version" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" -fi diff --git a/upgrade_php.sh b/upgrade_php.sh deleted file mode 100644 index c4300099..00000000 --- a/upgrade_php.sh +++ /dev/null @@ -1,354 +0,0 @@ -#!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=========================================================================" -echo "Upgrade PHP for LNMP, Written by Licess" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "=========================================================================" -cur_dir=$(pwd) - -if [ "$1" != "--help" ]; then - -old_php_version=`/usr/local/php/bin/php -r 'echo PHP_VERSION;'` -#echo $old_php_version -if [ -s /usr/local/mariadb/bin/mysql ]; then - ismysql="no" -else - ismysql="yes" -fi - -#set php version - - php_version="" - echo "Current PHP Version:$old_php_version" - echo "You can get version number from http://www.php.net/" - read -p "(Please input PHP Version you want):" php_version - if [ "$php_version" = "" ]; then - echo "Error: You must input php version!!" - exit 1 - fi - - if [ "$php_version" == "$old_php_version" ]; then - echo "Error: The upgrade PHP Version is the same as the old Version!!" - exit 1 - fi - echo "==================================================" - echo "You want to upgrade php version to $php_version" - echo "==================================================" - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - -echo "============================check files==================================" -if [ -s php-$php_version.tar.gz ]; then - echo "php-$php_version.tar.gz [found]" - else - echo "Error: php-$php_version.tar.gz not found!!!download now......" - wget -c http://www.php.net/distributions/php-$php_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download php-$php_version.tar.gz successfully!" - else - wget -c http://museum.php.net/php5/php-$php_version.tar.gz - if [ $? -eq 0 ]; then - echo "Download php-$php_version.tar.gz successfully!" - else - echo "WARNING!May be the php version you input was wrong,please check!" - echo "PHP Version input was:"$php_version - sleep 5 - exit 1 - fi - fi -fi - -if [ -s autoconf-2.13.tar.gz ]; then - echo "autoconf-2.13.tar.gz [found]" - else - echo "Error: autoconf-2.13.tar.gz not found!!!download now......" - wget -c http://soft.vpser.net/lib/autoconf/autoconf-2.13.tar.gz -fi -echo "============================check files==================================" - -echo "Stoping Nginx..." -/etc/init.d/nginx stop -if [ "$ismysql" = "no" ]; then - echo "Stoping MariaDB..." - /etc/init.d/mariadb stop -else - echo "Stoping MySQL..." - /etc/init.d/mysql stop -fi -echo "Stoping PHP-FPM..." -/etc/init.d/php-fpm stop -if [ -s /etc/init.d/memceached ]; then - echo "Stoping Memcached..." - /etc/init.d/memcacehd stop -fi - -rm -rf php-$php_version/ - -if [ -s /usr/local/autoconf-2.13/bin/autoconf ] && [ -s /usr/local/autoconf-2.13/bin/autoheader ]; then - echo "check autconf 2.13: OK" -else - tar zxvf autoconf-2.13.tar.gz - cd autoconf-2.13/ - ./configure --prefix=/usr/local/autoconf-2.13 - make && make install - cd ../ -fi - -ln -s /usr/lib/libevent-1.4.so.2 /usr/local/lib/libevent-1.4.so.2 -ln -s /usr/lib/libltdl.so /usr/lib/libltdl.so.3 - -if [ $php_version = "5.2.14" ] || [ $php_version = "5.2.15" ] || [ $php_version = "5.2.16" ] || [ $php_version = "5.2.17" ]; then - -if [ -s php-$php_version-fpm-0.5.14.diff.gz ]; then - echo "php-$php_version-fpm-0.5.14.diff.gz [found]" - else - echo "Error: php-$php_version-fpm-0.5.14.diff.gz not found!!!download now......" - wget -c http://php-fpm.org/downloads/php-$php_version-fpm-0.5.14.diff.gz -fi - -cd $cur_dir -echo "Stop php-fpm....." -if [ -s /usr/local/php/sbin/php-fpm ]; then -/usr/local/php/sbin/php-fpm stop -else -/etc/init.d/php-fpm stop -fi - -echo "Start install php-$php_version....." -export PHP_AUTOCONF=/usr/local/autoconf-2.13/bin/autoconf -export PHP_AUTOHEADER=/usr/local/autoconf-2.13/bin/autoheader -tar zxvf php-$php_version.tar.gz -gzip -cd php-$php_version-fpm-0.5.14.diff.gz | patch -d php-$php_version -p1 -cd php-$php_version/ -wget -c http://soft.vpser.net/web/php/bug/php-5.2.17-max-input-vars.patch -patch -p1 < php-5.2.17-max-input-vars.patch -./buildconf --force -if [ "$ismysql" = "no" ]; then - ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mariadb --with-mysqli=/usr/local/mariadb/bin/mysql_config --with-pdo-mysql=/usr/local/mariadb --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic -else - ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic -fi -if cat /etc/issue | grep -Eqi '(Debian|Ubuntu)';then - cd ext/openssl/ - wget -c http://soft.vpser.net/lnmp/ext/debian_patches_disable_SSLv2_for_openssl_1_0_0.patch - patch -p3 >/usr/local/php/etc/php.ini</usr/local/php/etc/php-fpm.conf<>/etc/rc.local -#echo "/etc/init.d/php-fpm start" >>/etc/rc.local -chkconfig --level 345 php-fpm on -chkconfig --level 345 nginx on -fi - -echo "Starting Nginx..." -/etc/init.d/nginx start -if [ "$ismysql" = "no" ]; then - echo "Starting MariaDB..." - /etc/init.d/mariadb start -else - echo "Starting MySQL..." - /etc/init.d/mysql start -fi -echo "Starting PHP-FPM..." -/etc/init.d/php-fpm start -if [ -s /etc/init.d/memceached ]; then - echo "Starting Memcached..." - /etc/init.d/memcacehd start -fi - -fi - -cd $cur_dir - -echo "=========================================================================" -echo "You have successfully upgrade from $old_php_version to $php_version" -echo "=========================================================================" -echo "LNMP is tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "=========================================================================" -echo "" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" -fi \ No newline at end of file diff --git a/vhost.sh b/vhost.sh deleted file mode 100644 index d313fd2a..00000000 --- a/vhost.sh +++ /dev/null @@ -1,197 +0,0 @@ -#!/bin/bash - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, use sudo sh $0" - exit 1 -fi - -clear -echo "=========================================================================" -echo "Add Virtual Host for LNMP , Written by Licess " -echo "=========================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to add virtual host for nginx " -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "=========================================================================" - -if [ "$1" != "--help" ]; then - - - domain="www.lnmp.org" - echo "Please input domain:" - read -p "(Default domain: www.lnmp.org):" domain - if [ "$domain" = "" ]; then - domain="www.lnmp.org" - fi - if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then - echo "===========================" - echo "domain=$domain" - echo "===========================" - else - echo "===========================" - echo "$domain is exist!" - echo "===========================" - fi - - echo "Do you want to add more domain name? (y/n)" - read add_more_domainame - - if [ "$add_more_domainame" == 'y' ]; then - - echo "Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):" - read moredomain - echo "===========================" - echo domain list="$moredomain" - echo "===========================" - moredomainame=" $moredomain" - fi - - vhostdir="/home/wwwroot/$domain" - echo "Please input the directory for the domain:$domain :" - read -p "(Default directory: /home/wwwroot/$domain):" vhostdir - if [ "$vhostdir" = "" ]; then - vhostdir="/home/wwwroot/$domain" - fi - echo "===========================" - echo Virtual Host Directory="$vhostdir" - echo "===========================" - - echo "===========================" - echo "Allow Rewrite rule? (y/n)" - echo "===========================" - read allow_rewrite - - if [ "$allow_rewrite" == 'n' ]; then - rewrite="none" - else - rewrite="other" - echo "Please input the rewrite of programme :" - echo "wordpress,discuz,typecho,sablog,dabr rewrite was exist." - read -p "(Default rewrite: other):" rewrite - if [ "$rewrite" = "" ]; then - rewrite="other" - fi - fi - echo "===========================" - echo You choose rewrite="$rewrite" - echo "===========================" - - echo "===========================" - echo "Allow access_log? (y/n)" - echo "===========================" - read access_log - - if [ "$access_log" == 'n' ]; then - al="access_log off;" - else - echo "Type access_log name(Default access log file:$domain.log):" - read al_name - if [ "$al_name" = "" ]; then - al_name="$domain" - fi - al="access_log /home/wwwlogs/$al_name.log access;" - echo "===========================" - echo You access log file="$al_name.log" - echo "===========================" - fi - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start create virtul host..." - char=`get_char` - - -if [ ! -d /usr/local/nginx/conf/vhost ]; then - mkdir /usr/local/nginx/conf/vhost -fi - -echo "Create Virtul Host directory......" -mkdir -p $vhostdir -touch /home/wwwlogs/$al_name.log -echo "set permissions of Virtual Host directory......" -chmod -R 755 $vhostdir -chown -R www:www $vhostdir - -if [ ! -f /usr/local/nginx/conf/$rewrite.conf ]; then - echo "Create Virtul Host ReWrite file......" - touch /usr/local/nginx/conf/$rewrite.conf - echo "Create rewirte file successful,now you can add rewrite rule into /usr/local/nginx/conf/$rewrite.conf." -else - echo "You select the exist rewrite rule:/usr/local/nginx/conf/$rewrite.conf" -fi - -cat >/usr/local/nginx/conf/vhost/$domain.conf<>/usr/local/php/etc/php.ini< /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start create virtul host..." - char=`get_char` - - -if [ ! -d /usr/local/nginx/conf/vhost ]; then - mkdir /usr/local/nginx/conf/vhost -fi - -echo "Create Virtul Host directory......" -mkdir -p $vhostdir -touch /home/wwwlogs/$al_name.log -echo "set permissions of Virtual Host directory......" -chmod -R 755 $vhostdir -chown -R www:www $vhostdir - -cat >/usr/local/nginx/conf/vhost/$domain.conf</usr/local/apache/conf/vhost/$domain.conf< -ServerAdmin webmaster@example.com -php_admin_value open_basedir "$vhostdir:/tmp/:/var/tmp/:/proc/" -DocumentRoot "$vhostdir" -ServerName $domain -ErrorLog "logs/$al_name-error_log" -CustomLog "logs/$al_name-access_log" common -
-eof - -if [ "$access_log" == 'n' ]; then -sed -i 's/ErrorLog/#ErrorLog/g' /usr/local/apache/conf/vhost/$domain.conf -sed -i 's/CustomLog/#CustomLog/g' /usr/local/apache/conf/vhost/$domain.conf -fi - -if [ "$add_more_domainame" == 'y' ]; then -sed -i "/ServerName/a\ -ServerAlias $moredomainame" /usr/local/apache/conf/vhost/$domain.conf -fi - -echo "Test Nginx configure file......" -/usr/local/nginx/sbin/nginx -t -echo "" -echo "Restart Nginx......" -/usr/local/nginx/sbin/nginx -s reload -echo "Restart Apache......" -/etc/init.d/httpd restart - -echo "=========================================================================" -echo "Add Virtual Host for LNMP, Written by Licess " -echo "=========================================================================" -echo "For more information please visit http://www.lnmp.org/" -echo "" -echo "Your domain:$domain $moredomainame" -echo "Directory of $domain:$vhostdir" -echo "" -echo "=========================================================================" -fi \ No newline at end of file diff --git a/xcache.sh b/xcache.sh deleted file mode 100644 index 1a2637d2..00000000 --- a/xcache.sh +++ /dev/null @@ -1,249 +0,0 @@ - #!/bin/bash -PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin -export PATH - -# Check if user is root -if [ $(id -u) != "0" ]; then - echo "Error: You must be root to run this script, please use root to install lnmp" - exit 1 -fi - -clear -echo "=======================================================================" -echo "Install XCache for LNMP , Written by Licess " -echo "=======================================================================" -echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " -echo "This script is a tool to install XCache for lnmp " -echo "" -echo "more information please visit http://www.lnmp.org " -echo "=======================================================================" -cur_dir=$(pwd) - - ver="new" - echo "Which version do you want to install:" - echo "Install XCache 2.0.1 please type: old" - echo "Install XCache 3.1.0 please type: new" - read -p "Type old or new (Default install XCache 3.1.0):" ver - if [ "$ver" = "" ]; then - ver="new" - fi - - if [ "$ver" = "old" ]; then - echo "You will install XCache 2.0.1" - echo "XCache 2 and eAccelerator cannot co-exist." - elif [ "$ver" = "new" ]; then - echo "You will install XCache 3.1.0" - else - echo "Input error,please input old or new !" - echo "Please Rerun $0" - exit 1 - fi - - xadmin_pass="" - read -p "Please input your admin password of XCache Administration Page:" xadmin_pass - if [ "$xadmin_pass" = "" ]; then - echo "password can't be NULL!" - exit 1 - else - echo "=================================================" - echo "Your admin password of xcache was:$xadmin_pass" - echo "=================================================" - fi - xmd5pass=`echo -n "$xadmin_pass" |md5sum |awk '{print $1}'` - - get_char() - { - SAVEDSTTY=`stty -g` - stty -echo - stty cbreak - dd if=/dev/tty bs=1 count=1 2> /dev/null - stty -raw - stty echo - stty $SAVEDSTTY - } - echo "" - echo "Press any key to start...or Press Ctrl+c to cancel" - char=`get_char` - - -echo "=========================== Install xcache ======================" -if [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/xcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/xcache.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so -elif [ -s /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/xcache.so ]; then - rm -f /usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/xcache.so -fi - -cur_php_version=`/usr/local/php/bin/php -v` -if [[ "$cur_php_version" =~ "PHP 5.2." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/xcache.so" -elif [[ "$cur_php_version" =~ "PHP 5.3." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/xcache.so" -elif [[ "$cur_php_version" =~ "PHP 5.4." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20100525/xcache.so" -elif [[ "$cur_php_version" =~ "PHP 5.5." ]]; then - zend_ext="/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/xcache.so" -else - echo "Error: can't get php version!" - echo "Maybe your php was didn't install or php configuration file has errors.Please check." - sleep 3 - exit 1 -fi - -cpu_count=`cat /proc/cpuinfo |grep -c processor` - -function install_old_xcache -{ -if [ -s xcache-2.0.1 ]; then - rm -rf xcache-2.0.1/ -fi -wget -c http://soft.vpser.net/web/xcache/xcache-2.0.1.tar.gz -tar zxvf xcache-2.0.1.tar.gz -cd xcache-2.0.1/ -/usr/local/php/bin/phpize -./configure --enable-xcache --enable-xcache-coverager --enable-xcache-optimizer --with-php-config=/usr/local/php/bin/php-config -make -make install -cd ../ - -sed -i '/;xcache/,/;xcache end/d' /usr/local/php/etc/php.ini -cat >>/usr/local/php/etc/php.ini<>/usr/local/php/etc/php.ini<