搭建完全分离式LNMP平台
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搭建完全分离式LNMP平台相关的知识,希望对你有一定的参考价值。
#nginx安装
#nginx-1.6.3.tar.gz yum install openssl openssl-devel -y yum install pcre pcre-devel -y wget -q http://nginx.org/download/nginx-1.6.3.tar.gz useradd www -s /sbin/nologin -M tar xf nginx-1.6.3.tar.gz cd nginx-1.6.3 ./configure --user=www --group=www --with-http_ssl_module --with-http_stub_status_module --prefix=/usr/local/nginx-1.6.3/ make && make install ln -s /usr/local/nginx-1.6.3/ /usr/local/nginx
location ~ .*\.(php|php5)?$ { root html/blog; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; }
cd /usr/local/nginx sbin/nginx -t sbin/nginx
mysql安装
tar xf mysql-5.5.49-linux2.6-x86_64.tar.gz mv mysql-5.5.49-linux2.6-x86_64 /usr/local/mysql-5.5.49 ln -s /usr/local/mysql-5.5.49 /usr/local/mysql chown -R mysql.mysql /usr/local/mysql/data cd echo ‘PATH="/usr/local/mysql/bin:$PATH"‘ >> .bash_profile chkconfig --add mysqld
创建用户 mysql -uroot -p123456 create database wordpress; show databases; grant all on wordpress.* to [email protected]‘172.16.1.%‘ identified by ‘123456‘; flush privileges;
PHP安装
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz tar zxf libiconv-1.14.tar.gz cd libiconv-1.14 ./configure --prefix=/usr/local/libiconv make && make install yum -y install libmcrypt-devel mhash mcrypt cd tar xf php-5.5.32.tar.gz cd php-5.5.32 ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/ touch ext/phar/phar.phar ./configure --prefix=/usr/local/php5.5.32 --with-mysql=mysqlnd --with-mysqli=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 --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --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-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --enable-opcache=no make && make install cp php.ini-production /usr/local/php5.5.32/lib/php.in cp php-fpm.conf.default php-fpm.conf /usr/local/php5.5.32/sbin/php-fpm cat > /usr/local/nginx/html/test.php <<EOF <?php $link=mysql_connect(‘172.16.1.52‘,‘wordpress‘,‘123456‘); if ($link) echo "Success..."; else echo "Failure..."; mysql_close(); phpinfo(); ?> EOF
以上是关于搭建完全分离式LNMP平台的主要内容,如果未能解决你的问题,请参考以下文章