LNMP安装
  • LNMP快速安装
  1. LNMP版本
  • linux:CentOS release 6.6 (Final)
  • nginx:nginx-1.6.3
  • mysql:mysql-5.5.48
  • php:php-5.5.36
  1. nginx-1.6.3安装

yum install -y pcre-devel

yum install -y openssl-devel

useradd -s /sbin/nologin -M nginx

ln -s /usr/local/lib/libpcre.so.1 /lib64

mkdir /server/tools -p

cd /server/tools

wget http://nginx.org/download/nginx-1.6.3.tar.gz

tar zxvf nginx-1.6.3.tar.gz

cd nginx-1.6.3

./configure –prefix=/application/nginx-1.6.3 –user=nginx –group=nginx –with-http_ssl_module –with-http_stub_status_module

make && make install

cd ..

ln -s /application/nginx-1.6.3 /application/nginx

cd /application/nginx/conf

egrep -v “#|^$” nginx.conf.default >nginx.conf

/application/nginx/sbin/nginx

ps -ef|grep nginx|egrep -v grep

  1. 安装mysql-5.5.48

安装依赖

yum install ncurses-devel libaio-devel -y

cd /server/tools/

wget https://cmake.org/files/v2.8/cmake-2.8.8.tar.gz

tar zxf cmake-2.8.8.tar.gz

cd cmake-2.8.8

./configure

gmake

gmake install

安装mysql

useradd mysql -s /sbin/nologin -M

cd /server/tools/

wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.48.tar.gz

tar zxvf mysql-5.5.48.tar.gz

cd mysql-5.5.48

cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.5.48 \

-DMYSQL_DATADIR=/application/mysql-5.5.48/data \

-DMYSQL_UNIX_ADDR=/application/mysql-5.5.48/tmp/mysql.sock \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \

-DENABLED_LOCAL_INFILE=ON \

-DWITH_INNOBASE_STORAGE_ENGINE=1 \

-DWITH_FEDERATED_STORAGE_ENGINE=1 \

-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \

-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \

-DWITHOUT_PARTITION_STORAGE_ENGINE=1 \

-DWITH_FAST_MUTEXES=1 \

-DWITH_ZLIB=bundled \

-DENABLED_LOCAL_INFILE=1 \

-DWITH_READLINE=1 \

-DWITH_EMBEDDED_SERVER=1 \

-DWITH_DEBUG=0

make && make install

ln -s /application/mysql-5.5.48/ /application/mysql

初始化数据库

cd /server/tools/mysql-5.5.48/support-files/

/bin/cp my-small.cnf /etc/my.cnf

chown -R mysql.mysql /application/mysql

/application/mysql/scripts/mysql_install_db –basedir=/application/mysql –datadir=/application/mysql/data –user=mysql

cd /server/tools/mysql-5.5.48/support-files/

cp mysql.server /etc/init.d/mysqld

chmod +x /etc/init.d/mysqld

chkconfig –add mysqld

chkconfig mysqld on

/application/mysql/bin/mysqld_safe &

sleep 2

echo ‘export PATH=”$PATH:/application/mysql/bin/”‘>> /etc/profile

source /etc/profile

mysqladmin -u root password ‘123456’

  1. php-5.5.36安装

安装依赖

rpm -aq zlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel

rpm -aq freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel

yum install zlib-devel libxml2-devel libjpeg-turbo-devel libiconv-devel -y

yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libtool-ltdl-devel openssl-devel -y

cd /server/tools/

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz

tar zxvf libiconv-1.14.tar.gz

cd libiconv-1.14

./configure –prefix=/usr/local/libiconv

make

make install

cd

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

yum install -y libmcrypt-devel

yum install mhash mhash-devel -y

yum install -y mcrypt

echo “/usr/local/lib” >>/etc/ld.so.conf

echo “/application/mysql-5.5.48/lib” >>/etc/ld.so.conf

ldconfig

mkdir ext/phar/phar.phar -p

php-5.3.36服务编译安装

cd /srever/tools

wget http://cn2.php.net/distributions/php-5.5.36.tar.gz

tar zxvf php-5.5.36.tar.gz

cd php-5.5.36

./configure \

–prefix=/application/php5.5.36 \

–with-mysql=/application/mysql \

–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=nginx \

–with-fpm-group=nginx \

–enable-ftp

make

make install

ln -s /application/php5.5.36 /application/php

cd /server/tools/php-5.5.36

cp php.ini-production /application/php/lib/php.ini

cd /application/php/etc

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

/application/php/sbin/php-fpm

ps -ef|grep php-fpm|grep -v grep|wc -l

  1. LNMP整合测试
  • 测试一:nginx、php整合

mkdir -p /var/html/{blog,bbs,www}

编辑blog的server配置区域中添加如下

location / {

root   /var/html/blog;

index  index.html index.htm;

}

location ~ .*\.(php|php5)?$ {

root   /var/html/blog;

fastcgi_pass  127.0.0.1:9000;

fastcgi_index index.php;

include /application/nginx/conf/fastcgi.conf;

}

n 创建php文件并编辑

vi /var/html/blog/phpinfo.php

<?php

phpinfo();

?>

Ø 测试:http://blog.etiantian.org/phpinfo.php

  • nginx、php、mysql整合

vi /var/html/blog/test_mysql.php

<?php

//$link_id=mysql_connect(‘主机名’,’用户’,’密码’);

$link_id=mysql_connect(“127.0.0.1″,”root”,”123456″);

if(!empty($link_id)){

echo “mysql successful by liwenbin !”;

}

else {

echo mysql_error();

}

//这是php单行注释

/*这是php多行注释*/

?>

Ø 测试:http://blog.etiantian.org/test_mysql.php

  1. 查看lamp各编译参数

查看nginx编译参数:

/usr/local/nginx/sbin/nginx -V

查看apache编译参数:

cat /usr/local/apache2/build/config.nice

查看mysql编译参数:

cat /usr/local/mysql/bin/mysqlbug | grep CONFIGURE_LINE

查看php编译参数:

usr/local/php/bin/php -i | grep configure

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇