LNMP环境部署

1、安装依赖包(系统采用最小化安装)

yum install -y vim lrzsz net-tools gcc gcc-c++ 

yum install -y libpng libpng-devel jpeg freetype freetype-devel libmcrypt mhash libtool libtool-devel libiconv fontconfig ncurses ncurses-devel pcre-devel openssl-devel libxml2 libxml2-devel libjpeg libjpeg-devel php-bcmath ntp net-snmp net-snmp-devel libcurl-devel 

sed -i 7s/enforcing/disabled/g /etc/selinux/config 

systemctl disable firewalld 

systemctl stop firewalld


cd /usr/local/src/

tar zxvf jpegsrc.v7.tar.gz

cd jpeg-7

./configure --prefix=/usr/local/jpeg && make && make install

tar zxvf  libiconv-1.14.tar.gz

cd libiconv-1.14

./configure --prefix=/usr/local/libiconv && make && make install


#编译 libiconv出错


make[2]: 正在进入目录 `/home/lmos/libiconv-1.14/srclib'

make[3]: 正在进入目录 `/home/lmos/libiconv-1.14'

make[3]: 没有什么可以做的为 `am--refresh'。

make[3]:正在离开目录 `/home/lmos/libiconv-1.14'

gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c allocator.c

gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c areadlink.c

gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c careadlinkat.c

gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c malloca.c

gcc -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I.. -I../lib -I../intl -DDEPENDS_ON_LIBICONV=1 -DDEPENDS_ON_LIBINTL=1 -g -O2 -c progname.c

In file included from progname.c:26:0:

./stdio.h:1010:1: 错误: ‘gets’未声明(不在函数内)

make[2]: *** [progname.o] 错误 1

make[2]:正在离开目录 `/home/lmos/libiconv-1.14/srclib'

make[1]: *** [all] 错误 2

make[1]:正在离开目录 `/home/lmos/libiconv-1.14/srclib'

make: *** [all] 错误 2


进入srclib目录 执行 sed -i -e '/gets is a security/d' ./stdio.in.h


2、安装mariadb

cp /usr/share/mysql/my-huge.cnf /etc/my.cnf

vim /etc/my.cnf

    character_set_server = utf8

systemctl start mariadb.service #启动mysql

systemctl enable mariadb.service #开机启动


3、安装nginx

cd /usr/local/src/

tar zxvf nginx-1.9.0.tar.gz

cd nginx-1.9.0

./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx --conf-path=/usr/local/nginx/nginx.conf --pid-path=/usr/local/nginx/nginx.pid --with-http_ssl_module

./configure

make && make install

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

location / {

root   html;

index  index.php index.html index.htm;

}   

location ~ \.php$ {

root           /usr/local/nginx/html;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;

include        fastcgi_params;

}

vim /usr/local/nginx/html/index.php

<?

phpinfo();

?>

/usr/local/nginx/sbin/nginx

 

 

4、安装gd

cd /usr/local/src/

tar zxvf gd-2.0.35.tar.gz

cd gd-2.0.35

./configure --prefix=/usr/local/gd --enable-shared && make && make install


5、安装php

cd /usr/local/src/

tar zxvf php-5.6.8.tar.gz

cd php-5.6.8

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-fpm --enable-mbstring --enable-xml --enable-bcmath --with-gd --enable-gd-native-ttf  --enable-sockets --with-gettext  --with-freetype-dir --with-jpeg-dir

make && make install 

cp /usr/local/src/php-5.6.8/php.ini-production /usr/local/php/etc/php.ini

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

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

chmod 755 /etc/init.d/php-fpm

sed -i 202s/Off/On/g /usr/local/php/etc/php.ini

sed -i s/;daemonize/daemonize/g /usr/local/php/etc/php-fpm.conf

service php-fpm start


你可能感兴趣的:(nginx,PHP,LNMP)