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

Lnmp源码安装

时间:2014-10-27 12:32:07      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:style   http   io   os   ar   sp   on   log   cti   

Lnmp

Centos6.5 + nginx/1.7.6 + PHP 5.3.29 + Mysql5.6.20

 

Nginx(/usr/local/nginx)

 

PHP(/usr/local/php)

 

Mysql(/usr/local/mysql)

 

Nginx

yum install zlib zlib-devel openssl openssl-devel pcre pcre-devel

useradd -M -d /dev/null -s /sbin/nologin

[root@Fantast nginx-1.7.6]# ./configure --prefix=/usr/local/nginx \
http-log-path=/var/log/nginx/access.log \
--error-log-path=/var/log/nginx/error.log \
--pid-path=/var/run/nginx/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--user=nginx \
--group=nginx \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_stub_status_module

make && make install

 

Mysql(mysql-advanced-5.6.20-linux-glibc2.5-x86_64)(二进制包安装)

yum install libaio-devel libaio -y

useradd -M -d /dev/null -s /sbin/nologin mysql

cd /usr/local

ln -s mysql-advanced-5.6.20-linux-glibc2.5-x86_64 mysql

cp mysql-advanced*/support-files/my-default.cnf /etc/my.cnf

cp mysql-advanced*/support-files/mysql.server /etc/init.d/mysqld

chmod 755 /etc/init.d/mysqld

cd mysql

chown -R mysql:mysql .

vim /etc/my.cnf

  datadir = /usr/local/mysql/data

  port = 3306

  socket = /var/lib/mysql/mysql.sock

  user = mysql

  pid-file = /var/run/mysql/mysqld.pid

  [mysqld_safe]

  log-error=/var/log/mysqld.log

mkdir /var/lib/mysql

chown mysql:mysql /var/lib/mysql

#安装

scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock # Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘  防止报这个错 原因不明

#启动mysql

bin/mysqld_safe --user=mysql &

 

PHP

php-fpm下载地址 http://php-fpm.org/downloads/

php-5.2.8-fpm-0.5.10.diff.gz(php-fpm源码)

#PHP5.3.3已经集成php-fpm 不在是第三方包 --enable-fpm

#PHP-FPM作为补丁加入PHP源码中

gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.3.29 -p1

cd php-5.3.29

./configure --prefix=/usr/local/php --enable-mbstring --without-sqlite  --without-sqlite3 --without-pdo-sqlite --with-mysql=/usr/local/mysql --enable-fpm

make && make install

cp php.ini-production  /usr/local/php/lib/php.ini

#php-fpm 配置

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf

vim /usr/local/php/etc/php-fpm.conf

  user = nginx

  group = nginx

  listen.allowed_clients = 127.0.0.1\

#启动fastcgi进程

/usr/local/php/sbin/php-fpm

 

#配置nginx 支持php

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

  location ~ \.php$ {

  root /data/nginx;

  fastcgi_pass 127.0.0.1:9000;

  fastcgi_index index.php;

  fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;

  include fastcgi_params;

  }

 

 

Lnmp源码安装

标签:style   http   io   os   ar   sp   on   log   cti   

原文地址:http://www.cnblogs.com/metasequoia/p/4053775.html

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