标签:lnmp
提要:MySQL5.6版本对系统内存有一定需求,512M内存无法运行
PHP5.5 、nginx1.7以上版本通用
yum install -y make gcc gcc-c++ autoconf automake libpng-devel libjpeg-devel zlib libxml2-devel ncurses-devel bison libtool-ltdl-devel libiconv libmcrypt mhash mcrypt libmcrypt-devel pcre-devel openssl-devel freetype-devel libcurl-devel
cd nginx-1.9.5
vi auto/cc/gcc
#将这句注释掉 取消Debug编译模式 大概在174行
#CFLAGS="$CFLAGS -g"
useradd -M -s /sbin/nologin/ www ##创建NGINX用户
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module
make&&make install
vim /usr/local/nginx/conf/nginx.conf
##开启此模块解析PHP页面location ~ \.php$ { XXXX}
/usr/local/nginx/sbin/nginx ##启动nginx
安装MySQL免安装版
useradd -M -s /sbin/nologin mysql
mkdir -p /data/mysql
chown -R mysql:mysql /data/mysql
cd /usr/local/mysql
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/data/mysql --user=mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld ##复制启动文件
vim /usr/local/mysql/my.cnf ##修改mysql配置文件
修改以下内容:
datadir = /data/mysql
port = 3306
# server_id = .....
socket = /tmp/mysql.sock
/etc/init.d/mysqld start ##启动mysql
注意:系统是64位的下面需要指定路径/usr/lib64 如果是32位则/usr/lib
./configure --prefix=/usr/local/php --with-mysql --with-mysqli --with-iconv-dir --with-zlib --with-libxml-dir --enable-xml --with-curl --enable-fpm --enable-mbstring --with-gd --with-openssl --with-mhash --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-libdir=/usr/lib64 --with-jpeg-dir=/usr/lib64 --with-freetype-dir=/usr/lib64 --with-png-dir=/usr/lib64 --with-mcrypt
make&&make install clean
cp php.ini-development /usr/local/php/lib/php.ini ##复制配置文件
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm ##复制启动文件
cd /usr/local/php/etc/
cp php-fpm.conf.default php-fpm.conf ##复制启动文件的配置文件
service php-fpm start ##启动PHP
本文出自 “linux小记” 博客,请务必保留此出处http://lstulinux.blog.51cto.com/3938932/1698774
LNMP安装Nginx1.9.5+PHP5.5+MySQL5.6
标签:lnmp
原文地址:http://lstulinux.blog.51cto.com/3938932/1698774