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

源码lnmp

时间:2016-07-01 16:49:12      阅读:242      评论:0      收藏:0      [点我收藏+]

标签:lnmp

1、准备工作:

配置yum源

安装开发工具、编译工具gcc gcc-c++ make

配置固定ip地址 关闭iptables selinux

netstat -anpult | grep :3306

netstat -anpult | grep :80

若端口占用kill

并service httpd stop ; chkconfig httpd off

service mysqld stop ; chkconfig mysqld off 

mv /etc/my.cnf /etc/my.cnf.bak

2、源码安装nginx-1.2.0:

下载nginx-1.2.0

useradd -s /sbin/nologin -M www

进入nginx-1.2.0目录

./configure --prefix=/usr/local/nginx --pid-path=/usr/local/nginx/nginx.pid --user=www   --group=www --with-http_ssl_module   --with-http_flv_module --with-http_stub_status_module --with-http_gzip_static_module

无错误后make && meke install

启动服务/usr/local/nginx/sbin/nginx

访问测试elinks --dump http://localhost

看到 Welcome to nginx 表示nginx安装完成。

3、安装源码mysql:

useradd -s /sbin/nologin -M mysql

下载cmake-2.8.10.2.tar.gz

tar -zxf cmake-2.8.10.2.tar.gz

cd cmake-2.8.10.2

./bootstrap --prefix=/usr/local/cmake

make && makeinstall

下载mysql-5.5.13.tar.gz

tar -zxf mysql-5.5.13.tar.gz

cd mysql-5.5.13

/usr/local/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql    -DSYSCONFDIR=/etc   -DMYSQL_DATADIR=/usr/local/mysql/data  -DMYSQL_TCP_PORT=3306   -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock   -DMYSQL_USER=mysql   -DEXTRA_CHARSETS=all   -DWITH_READLINE=1   -DWITH_SSL=system   -DWITH_EMBEDDED_SERVER=1   -DENABLED_LOCAL_INFILE=1   -DWITH_INNOBASE_STORAGE_ENGINE=1

无错误后make && make install

初始化授权库

cd /usr/local/mysql

./scripts/mysql --user=mysql

生成主配置文件

cp /mysql-5.5.13/support-files/my-medium.cnf /etc/my.cnf

echo "export PATH=/usr/local/mysql/bin/:$PATH" >> /etc/profile    

mysqladmin -uroot password ‘123‘

jobs

[1]+  Running      /usr/local/mysql/bin/mysqld_safe --user=mysql &

kill -9 %1

cp /mysql-5.5.13/support-files/mysql.server /etc/init.d/mysqldd

chmod +x /etc/init.d/mysqldd

chkconfig --add mysqldd

chown -R mysql:mysql /usr/local/mysql/

4、安装PHP:

下载php-5.4.9.tar.gz  libmcrypt-2.5.8.tar.gz  mhash-0.9.9.9.tar.gz  libiconv-1.13.tar.gz

tar -zxf php-5.4.9.tar.gz

tar -zxf mhash-0.9.9.9.tar.gz

tar -zxf libmcrypt-2.5.8.tar.gz

tar -zxf libiconv-1.13.tar.gz

./mhash-0.9.9.9/configure && make && make insetall

./libmcrypt-2.5.8/configure && make && make install

cd libmcrypt-2.5.8/libltdl

./configure  --with-gmetad  --enable-gexec  --enable-ltdl-install

make && make install

./libiconv-1.13configure && make && make install


yum -y install libxml2-devel

yum -y install libcurl

yum -y install libjpeg-devel

yum -y install libpng-devel

yum -y install libpng-devel

yum -y install freetype-devel

yum -y install openldap-devel

yum -y install php-ldap

cp -frp /usr/lib64/libldap* /usr/lib/

cd php-5.4.9

ln -sv /usr/local/lib/libmcrypt*     /usr/lib/

ln -sv /usr/local/lib/libmhash*    /usr/lib/

ln -sv /usr/local/lib/libiconv*    /usr/lib/

ldconfig  -v

./configure --prefix=/usr/local/php5nginx --with-config-file-path=/usr/local/php5nginx/etc  --with-mysql=/usr/local/mysql  --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --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   --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-ldap   --with-ldap-sasl --with-xmlrpc    --enable-zip   --enable-soap

make  ZEND_EXTRA_LIBS=‘-liconv‘

make install

cp php-5.4.9/php.ini-production /usr/local/php5nginx/etc/php.ini

nginx + fast-cgi 使nginx能够解析php页面

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

cd /usr/local/php6nginx/

grep -v "^;" php-fpm.conf | grep -v "^$"

cp php-5.4.9/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm

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

chkconfig --add php-fpm

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

65-71行取消注释

echo "fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;" >> /usr/local/nginx/conf/fastcgi_params

/usr/local/nginx/sbin/nginx -t

/usr/local/nginx/sbin/nginx -s stop

/usr/local/nginx/sbin/nginx

echo "

<?php

    #echo "hello world!!!";

phpinfo();

?>" > /usr/local/nginx/html/test.php


测试平台

1、测试nginx能否解析php页面。

未完成


源码lnmp

标签:lnmp

原文地址:http://105496232.blog.51cto.com/3895811/1794749

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