献上脚本: #!/bin/sh ##lnmp by liycwing################ #version:V2 htmldir=(www bbs blog) datadir=/data/www function nginx(){ yum install pcre pcre-devel openssl openssl-devel -y cd /application/tools/ wget http://nginx.org/download/nginx-1.6.2.tar.gz tar xf nginx-1.6.2.tar.gz cd nginx-1.6.2 useradd nginx -s /sbin/nologin -M ./configure --user=nginx --group=nginx --prefix=/application/nginx1.6.2 --with-http_stub_status_module --with-http_ssl_module make &&make install sleep 2 ln -s /application/nginx1.6.2/ /application/nginx /application/nginx/sbin/nginx echo 'nginx is ok' sleep 20 } function html(){ /application/nginx/sbin/nginx -s stop mkdir ${datadir}/{www,blog,bbs} -p mkdir /applogs/nginxlog/ -p for name in ${htmldir[@]};do echo "this is test $name index.html `hostname`">${datadir}/$name/index.html;done remote_addr='$remote_addr' remote_user='$remote_user' time_local='$time_local' request='$request' status='$status' body_bytes_sent='$body_bytes_sent' http_referer='$http_referer' http_user_agent='$http_user_agent' http_x_forwarded_for='$http_x_forwarded_for' a='$1' cat >/application/nginx/conf/nginx.conf <<liycwing user nginx; pid /applogs/nginxlog/nginx.pid; worker_processes 1; error_log /applogs/nginxlog/error.log error; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; server { listen 80; server_name liycwingjunjie.org; rewrite ^/(.*) http://www.liycwingjunjie.org/${a} permanent; } # server { # listen 80; # server_name status.liycwingjunjie.org; # stub_status on; # access_log off; # } include extra/${htmldir[0]}.conf; include extra/${htmldir[1]}.conf; include extra/${htmldir[2]}.conf; } liycwing mkdir /application/nginx/conf/extra -p for name in ${htmldir[@]} do cat >/application/nginx/conf/extra/${name}.conf <<liycwing server { listen 80; server_name ${name}.liycwingjunjie.org; root ${datadir}/${name}; index index.php index.html index.htm; access_log /applogs/nginxlog/${name}_access.log; location ~ .*\.(php|php5)?$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } liycwing done echo 'html is ok' sleep 20 } function mysql(){ yum install ncurses-devel libaio-devel -y cd /application/tools tar zxf cmake-2.8.8.tar.gz cd cmake-2.8.8 ./configure gmake gmake install sleep 2 cd .. groupadd mysql useradd mysql -s /sbin/nologin -M -g mysql cd /application/tools/ tar zxf mysql-5.5.32.tar.gz cd /application/tools/mysql-5.5.32 cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.32 \ -DMYSQL_DATADIR=/application/mysql-5.5.32/data \ -DMYSQL_UNIX_ADDR=/application/mysql-5.5.32/tmp/mysql.sock \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \ -DENABLED_LOCAL_INFILE=ON \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_FEDERATED_STORAGE_ENGINE=1 \ -DWITH_BLACKHOLE_STORAGE_ENGINE=1 \ -DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \ -DWITHOUT_PARTITION_STORAGE_ENGINE=1 \ -DWITH_FAST_MUTEXES=1 \ -DWITH_ZLIB=bundled \ -DENABLED_LOCAL_INFILE=1 \ -DWITH_READLINE=1 \ -DWITH_EMBEDDED_SERVER=1 \ -DWITH_DEBUG=0 make && make install sleep 2 ln -s /application/mysql-5.5.32/ /application/mysql echo 'mysql is ok' sleep 20 } #####wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo ##### ##### ####yum install mhash mhash-devel libmcrypt-devel mcrypt -y #### ####4、其他需要mysql相关包场景的PHP对应编译参数 ####--enable-mysqlnd \ ####--with-pdo-mysql=mysqlnd \ ####--with-mysqli=mysqlnd \ #### #### function php(){ yum install zlib libxml2 libjpeg freetype libpng gd curl zlib-devel libxml2-devel libjpeg-devel freetype-devel libpng-devel gd-devel curl-devel openssl-devel libxslt-devel -y if [ ! $? -eq 0 ] then echo "yum install php packbage error" exit 1 fi cd /application/tools wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar xf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make &&make install sleep 2 cd /application/tools tar xf libmcrypt-2.5.8.tar.gz cd libmcrypt-2.5.8 ./configure make make install sleep 2 /sbin/ldconfig cd libltdl/ ./configure --enable-ltdl-install make make install sleep 2 cd /application/tools tar xf mhash-0.9.9.9.tar.gz cd mhash-0.9.9.9 ./configure make make install sleep 2 cd ../ rm -f /usr/lib64/libcrypt.* rm -f /usr/lib64/libmhash* ln -s /usr/local/lib64/libmcrypt.la /usr/lib64/libmcrypt.la ln -s /usr/local/lib64/libmcrypt.so /usr/lib64/libmcrypt.so ln -s /usr/local/lib64/libmcrypt.so.4 /usr/lib64/libmcrypt.so.4 ln -s /usr/local/lib64/libmcrypt.so.4.4.8 /usr/lib64/libmcrypt.so.4.4.8 ln -s /usr/local/lib64/libmhash.a /usr/lib64/libmhash.a ln -s /usr/local/lib64/libmhash.la /usr/lib64/libmhash.la ln -s /usr/local/lib64/libmhash.so /usr/lib64/libmhash.so ln -s /usr/local/lib64/libmhash.so.2 /usr/lib64/libmhash.so.2 ln -s /usr/local/lib64/libmhash.so.2.0.1 /usr/lib64/libmhash.so.2.0.1 ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-config cd /application/tools tar xf mcrypt-2.6.8.tar.gz cd mcrypt-2.6.8 /sbin/ldconfig ./configure LD_LIBRARY_PATH=/usr/local/lib make make install sleep 2 ####--with-mysql=mysqlnd ####方法1 ####ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/ ####touch ext/phar/phar.phar ####方法2 ####libmysqlclient的错误,echo "/application/mysql/lib">>/etc/ld.so.conf ####ldconfig #### #### ####yum install openssl-devel -y cd /application/tools tar xf php-5.3.27.tar.gz cd php-5.3.27 ./configure \ --prefix=/application/php5.3.27 \ --with-mysql=/application/mysql \ --with-iconv-dir=/usr/local/libiconv \ --with-freetype-dir \ --with-jpeg-dir \ --with-png-dir \ --with-zlib \ --with-libxml-dir=/usr \ --enable-xml \ --disable-rpath \ --enable-safe-mode \ --enable-bcmath \ --enable-shmop \ --enable-sysvsem \ --enable-inline-optimization \ --with-curl \ --with-curlwrappers \ --enable-mbregex \ --enable-fpm \ --enable-mbstring \ --with-mcrypt \ --with-gd \ --enable-gd-native-ttf \ --with-openssl \ --with-mhash \ --enable-pcntl \ --enable-sockets \ --with-xmlrpc \ --enable-zip \ --enable-soap \ --enable-short-tags \ --enable-zend-multibyte \ --enable-static \ --with-xsl \ --with-fpm-user=nginx \ --with-fpm-group=nginx \ --enable-ftp ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/ make make install sleep 2 ln -s /application/php5.3.27/ /application/php /bin/cp /application/tools/php-5.3.27/php.ini-production /application/php/lib/php.ini mkdir /applogs/phplog/ -p /bin/mv /application/scripts/php-fpm.conf.V1 /application/php/etc/php-fpm.conf echo 'php is ok' sleep 20 } ########################################################################### function lnmpstart(){ cat >>/etc/rc.local <<liycwing #nginx+php-fpm by liycwing at 2014 #/etc/init.d/mysqld start /application/php/sbin/php-fpm /application/nginx/sbin/nginx liycwing } ########################################################################### function start(){ /application/php/sbin/php-fpm /application/nginx/sbin/nginx -t /application/nginx/sbin/nginx } ########################################################################### function phptest1(){ cat > /data/www/bbs/index.php <<liycwing <?php $link_id=mysql_connect('localhost','root','liycwing123') or mysql_error(); if($link_id){ echo "mysql successful by liycwing!"; }else{ echo mysql_error(); } ?> liycwing } ########################################################################### function phptest2(){ cat > /data/www/bbs/index.php <<liycwing <?php phpinfo(); ?> liycwing } nginx html
install--LNMP_v2.sh 配置信息模版
原创
©著作权归作者所有:来自51CTO博客作者Liyanchaolinux的原创作品,请联系作者获取转载授权,否则将追究法律责任
![](https://ucenter.51cto.com/images/noavatar_middle.gif)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
配置信息配置 职场 休闲
-
vsftpd 配置信息
网络搜集的vsftpd的配置信息
配置 职场 FTP服务器 休闲 vsftpd -
SpringBoot基础篇配置信息之多环境配置信息
更多Spring文章,欢迎点击 一灰灰Blog-Spring专题前面一篇主要介绍的是如何获取配置信息,接下来则是另外一个非常非常基础和必要的知识点了
Java Spring SpringBoot 配置 spring