码迷,mamicode.com
首页 > 其他好文 > 详细

LNMP

时间:2016-05-13 05:12:31      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:lnmp

                         nginx搭建lnmp

  • 安装nginx

  • 准备环境:yum  -y install pcre-develzlib-devel ,rpm -e httpd  --nodeps,

useradd -M -s/sbin/nologin   nginx

  1. 2.  tar   xf  nginx-1.6.0.tar.gz -C  /usr/src/

  2. 3.  cd/usr/src/nginx-1.6.0/ 

  3. 4.  ./configure--prefix=/usr/local/nginx --user=nginx --group=nginx--with-http_stub_status_module

  4. 5.  make  && make install

  5. 6.  ln -s/usr/local/nginx/sbin/* /usr/local/sbin/

  6. 7.  nginx-t  ;  nginx 

  7. 8.  netstat-anpt | grep 80

  8. 二、安装MySQL

  9. 1.  rpm  -e   mysql  --nodeps rpm  -e  mysql-devel  --nodeps

  10. 2.  useradd   -s  -M  /sbin/nologin   mysql

  11. 3.  tar  xf cmake-TAB

  12. 4.  cd/root/cmake-TAB

  13. 5.  ./configure  && gmake  && gmake  install

  14. 6.  tarxf  mysql-TAB  -C /usr/src/

  15. 7.  cd   /usr/src/mysql-TAB

  16. 8.  cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/mysql   -DDEFAULT_CHARSET=utf8

-DDEFAULT_COLLATION=utf8_general_ci  -DSYSCONFDIR=/etc   -DWITH_EXTRA_CHARSETS=all

  1. 9.  make  && make  install

  2. 10.          chown  -R mysql.mysql   /usr/localmysql

  3. 11.          ln-s  /usr/local/mysql/bin/*  /usr/local/bin/

  4. 12.          cp/usr/src/mysql-TAB/support-files/my-medium.cnf    /etc/my.cnf

  5. 13.          cp /usr/src/mysql-TAB/support-files/mysql.server/etc/init.d/mysqld 

  6. 14.          chmod+x  /etc/init.d/mysqld    chkconfig --add mysqld chkconfig mysqld on

  7. 15.          /usr/local/mysql/scripts/mysql_install_db--user=mysql --basedir=/usr/local/mysql/ 

--datadir=/usr/local/mysql/data/

  1. 16.          servicemysqld restart     netstat -tunlp | grep3306

  2. 17.          mysqladmin-u root password ‘123.com‘

  3. 三、安装PHP

  4. 1.  yum -yinstall gd libxml2-devel libjpeg-delvel libpng-devel

  5. 2.  tar-zxvf php-TAB.tar.gz   -C   /usr/src/

  6. 3.  cd  php-TAB 

  7. 4.  ./configure--prefix=/usr/local/php --with-gd --with-zlib --with-mysql=/usr/local/mysql/--with-config-file-path=/usr/local/php --enable-mbstring --enable-fpm--with-jpeg-dir=/usr/lib

  8. 5.  make&& make install

  9. 6.  cp/usr/src/php-TAB/php.ini-development    /usr/local/php/php.ini

  10. 7.  vim/usr/local/php/php.ini 

修改这两项:default_charset= "utf-8"

short_open_tag= On

  1. 8.  ln -s/usr/local/php/bin/* /usr/local/bin/

  2. 9.  ln -s/usr/local/php/sbin/*   /usr/local/sbin/

  3. 10.          添加优化模块

  4. a)  tar -zxvf ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz -C /usr/src/ 

  5. b)cp /usr/src/ZendGuardLoader-php-5.3-linux-glibc23-x86_64/php-5.3.x/ZendGuardLoader.so/usr/local/php/lib/php/ 

  6. c)  vim/usr/local/php/php.ini   添加:

                                                                                       i.           zend_extension=/usr/local/php/lib/php/ZendGuardLoader.so

                                                                                     ii.           zend_loader.enable=1

创建php-fpm.conf

cp php-fpm.conf.default php-fpm.conf

vim php-fpm.conf 修改:

pid =run/php-fpm.pid

user = php

group = php

pm.max_children = 50

pm.start_servers = 20

pm.min_spare_servers = 5

pm.max_spare_servers = 35

       /usr/local/sbin/php-fpm

       netstat -anpt | grep  php-fpm

cp /usr/src/php-TAB/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

chmod +x /etc/init.d/php-fpm

 

 

vim /usr/local/nginx/conf/nginx.conf

       index  index.php (添加到location的总文件中)

location ~ \.php$ {

           root           html;

           fastcgi_pass  127.0.0.1:9000;  ###注意

           fastcgi_index  index.php;

           fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

           include        fastcgi.conf;    ###注意

       }

重启nginx 来验证 :

              echo “<?php

phpinfo ();

?>” >>  /usr/local/nginx/html/index.php   

       验证与数据库的链接:

                         echo  “<?php

$link=mysql_connect(‘localhost‘,‘root‘,‘123.com‘);               

if($link) echo "恭喜你,数据库连接成功啦!!";                  

mysql_close();                                                  

?> “ >> /usr/local/nginx/html/index2.php

  • 部署电影系统

  • unzipSKYUC.v3.4.2.SOURCE.zip

  • cp -rSKYUC.v3.4.2.SOURCE/wwwroot/   /usr/local/nginx/html/skyuc

  • chown-R php.php  /usr/local/nginx/html/skyuc/admincp/    /usr/local/nginx/html/skyuc/data/  /usr/local/nginx/html/skyuc/upload/  /usr/local/nginx/html/skyuc/templates/ 

  • 创建数据库 create database skyucdb;   grantall on skyucdb.* to ‘root‘@‘localhost‘ identified by ‘123.com‘;

  • firefoxhttp://192.168.1.200/skyuc/install/index.php &




本文出自 “10706057” 博客,请务必保留此出处http://10716057.blog.51cto.com/10706057/1772591

LNMP

标签:lnmp

原文地址:http://10716057.blog.51cto.com/10706057/1772591

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!