首页 > 代码库 > centos7 配置nmp环境
centos7 配置nmp环境
nginx 直接编译安装即可,放在/usr/local/nginx下就可以了
yum install -y gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libpng libpng-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses curl openssl-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel readline-devel libxslt-devel expat-devel xmlrpc-c xmlrpc-c-devel
libmcrypt(libmcrypt-2.5.8.tar.gz ):
mcrypt(mcrypt-2.6.8.tar.gz ):
mhash(mhash-0.9.9.9.tar.gz ):
2 .先安装Libmcrypt
#tar -zxvf libmcrypt-2.5.8.tar.gz#cd libmcrypt-2.5.8#./configure#make#make install 说明:libmcript默认安装在/usr/local
3.安装mhash
#tar -zxvf mhash-0.9.9.9.tar.gz#cd mhash-0.9.9.9#./configure#make#make install
4.安装mcrypt
#tar -zxvf mcrypt-2.6.8.tar.gz#cd mcrypt-2.6.8#LD_LIBRARY_PATH=/usr/local/lib ./configure#make#make install
cd php-5.6.3
Don‘t forget to run ‘make test‘.
cp /usr/local/php/etc/php-fpm.conf.default php-fpm.conf
//复制一份并重命名
/usr/local/php/sbin/php-fpm
//启动php-fpm
修改FPM 配置文件php-fpm.conf
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
去掉分号
ln -s /usr/local/php/sbin/php-fpm /bin/php-fpm
cp /usr/local/src/php/php.ini-producsion /usr/local/php/lib/php.ini //此步骤可能不成功没关系
至此php-fpm安装完成
将root 拿出 location / 然后将index.php加在index.htm后面
rm -rf /etc/my.cnf #删除系统默认的配置文件(如果默认没有就不用删除)
cd /usr/local/mysql #进入MySQL安装目录
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/data/mysql #生成mysql系统数据库
ln -s /usr/local/mysql/my.cnf /etc/my.cnf #添加到/etc目录的软连接
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld #把Mysql加入系统启动
chmod 755 /etc/init.d/mysqld #增加执行权限
chkconfig mysqld on #加入开机启动
vi /etc/rc.d/init.d/mysqld #编辑
basedir=/usr/local/mysql #MySQL程序安装路径
datadir=/data/mysql #MySQl数据库存放目录
service mysqld start #启动
vi /etc/profile #把mysql服务加入系统环境变量:在最后添加下面这一行
export PATH=$PATH:/usr/local/mysql/bin
source /etc/profile
下面这两行把myslq的库文件链接到系统默认的位置,这样你在编译类似PHP等软件时可以不用指定mysql的库文件地址。
ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql
ln -s /usr/local/mysql/include/mysql /usr/include/mysql
mkdir /var/lib/mysql #创建目录
ln -s /data/mysql/mysql.sock /var/lib/mysql/mysql.sock #添加软链接
mysql_secure_installation #设置Mysql密码,根据提示按Y 回车输入2次密码
mysql配置可以远程连接
grant all privileges on *.* to root@‘%‘ identified by ‘123456‘;
root 表示远程登入的用户名
123456表示密码
%表示所有ip,也可以自己设ip
centos7 配置nmp环境