标签:
基于lanny一键安装包:(含lnmp所需软件及配置文件)
安装nginx:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo yum clean all yum makecache yum install pcre pcre-devel openssl openssl-devel -y useradd -s /sbin/nologin -M nginx cd /home/lanny/tools/&&tar xf nginx-1.6.2.tar.gz cd /home/lanny/tools/nginx-1.6.2 &&./configure --user=nginx --group=nginx --prefix=/application/nginx-1.6.2 --with-http_stub_status_module --with-http_ssl_module make && make install echo $? ln -s /application/nginx-1.6.2/ /application/nginx
cd /home/lanny/tools/&&unzip nginx_config.zip cd /home/lanny/tools/nginx_config mkdir -p /application/nginx/conf/extra \cp *.conf /application/nginx/conf/extra/ \mv /application/nginx/conf/extra/nginx.conf /application/nginx/conf/ /application/nginx/sbin/nginx -t /application/nginx/sbin/nginx /application/nginx/sbin/nginx -s reload mkdir /application/nginx/html/{www,blog,bbs} for n in www blog bbs;do echo "$n.lanny.com" > /application/nginx/html/$n/index.html;done for n in www blog bbs;do cat /application/nginx/html/$n/index.html;done mkdir /data/html/ -p mv /application/nginx/html/* /data/html/
安装mysql:(集成)
mkdir -p /application/mysql-5.5.32 cd /home/lanny/tools/ &&tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz mv /home/lanny/tools/mysql-5.5.32-linux2.6-x86_64/* /application/mysql-5.5.32 ln -s /application/mysql-5.5.32 /application/mysql useradd -s /sbin/nologin -M mysql cd /application/mysql/data &&rm -rf *
chown -R mysql.mysql /application/mysql/data/ \cp /application/mysql/support-files/my-small.cnf /etc/my.cnf \cp /application/mysql/support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld sed -i ‘s#/usr/local/mysql#/application/mysql#g‘ /etc/init.d/mysqld sed -i ‘s#/usr/local/mysql#/application/mysql#g‘ /application/mysql/bin/mysqld_safe echo ‘export PATH=”/application/mysql/bin/:$PATH”‘>>/etc/profile /application/mysql/scripts/mysql_install_db --user=mysql --basedir=/application/mysql/ --datadir=/application/mysql/data/ /application/mysql/bin/mysqld_safe & netstat -ntulp|egrep "mysql|nginx"
安装php:
yum install zlib-devel libxml2-devel libjpeg-devel libiconv-devel -y yum install freetype-devel libpng-devel gd-devel curl-devel libxslt-devel -y rpm -qa zlib-devel libxml2-devel rpm -qa freetype-devel libjpeg-turbo-devel libpng-devel gd-devel libcurl-devel libxslt-devel yum install libmcrypt-devel mhash mhash-devel mcrypt -y rpm -qa libmcrypt-devel mhash mhash-devel mcrypt libxslt-devel libiconv-devel手动装 wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.14.tar.gz cd /home/lanny/tools/ tar xf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make make install cd /home/lanny/tools tar xf php-5.3.27.tar.gz ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/ touch /home/lanny/tools/php-5.3.27/ext/phar/phar.phar
cd /home/lanny/tools tar xf php-5.3.27.tar.gz cd php-5.3.27 ./configure --prefix=/application/php-5.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 --enable-safe-mode --disable-rpath --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 make && make install ln -s /application/php-5.3.27 /application/php
cp /home/lanny/tools/php-5.3.27/php.ini-production /application/php/lib/php.ini cd /application/php/etc/ &&cp /home/lanny/tools/php-fpm.conf.default ./php-fpm.conf mkdir /app/logs/ -p touch /app/logs/php-fpm.log /application/php/sbin/php-fpm -t /application/php/sbin/php-fpm netstat -ntulp|egrep "80|330|9000"
nginx支持 php
\cp /home/lanny/tools/bbs.conf /application/nginx/conf/extra/ /application/nginx/sbin/nginx -s reload 开机自启动: /application/nginx/sbin/nginx /etc/init.d/mysqld start /application/php/sbin/php-fpm
完整的bbs配置:
/application/nginx/conf/extra/bbs.conf
server {
listen 80;
server_name bbs.lanny.com;
root /data/html/bbs;
index index.html index.php index.htm;
access_log logs/bbs_access.log;
location ~ .*\.(php|php5)?$
{
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}
}
数据库连接测试:
dbconn.php
<?php //$link_id=mysql_connect(‘主机名‘,‘用户‘,‘密码‘); $link_id=mysql_connect(‘localhost‘,‘root‘,‘123456‘) or mysql_error(); if($link_id){ echo "mysql successful by lanny !"; }else{ echo mysql_error(); } ?>
mysql和np安装脚本-----np和mysql分离
./configure --prefix=/application/php-5.3.27 --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-safe-mode --disable-rpath --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
以上至少38行,其实39行
安装discuzz
cd /home/lanny/tools/ &&wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_UTF8.zip unzip Discuz_X3.2_SC_UTF8.zip rm -rf readme/ utility/ mv upload/* /data/html/bbs chown -R nginx.nginx /data/html/bbs 创建数据库: create database bbs; grant all on bbs.* to bbs@‘localhost‘ identified by ‘bbs‘;flush privileges; #安装的时候数据库bbs 密码bbs
标签:
原文地址:http://www.cnblogs.com/iiiiher/p/5693902.html