nginx 直接编译安装即可,放在/usr/local/nginx下就可以了
php的安装
首先添加依赖应用
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,mhash,mcrypt安装包
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
tar zxvf php-5.6.3.tar.gz
cd php-5.6.3
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-mysql-sock --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --with-ncurses --enable-soap --with-libxml-dir --with-XMLrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --disable-mbregex --disable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-pdo-mysql --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear
然后
make && make install
Build complete.
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安装完成
编辑php.ini文件
vi /etc/php.ini
将cgi.fix_pathinfo前的#去除vi
/etc/php-fpm.d/www.conf
修改
listen = 127.0.0.1:9000
启动 systemctl start php-fpm
修改nginx配置文件
我是编译安装的所以是在vi
/usr/local/nginx/conf/nginx.conf
将root 拿出 location / 然后将index.php加在index.htm后面
并且配置root的路径就是nginx的html文件位置
然后设置php
将fastcgi_param中$fastcgi_script_name前的一个变量替换成nginx的html文件位置
然后启动nginx,已经启动的就重启nginx
/usr/local/nginx/sbin/nginx启动
/usr/local/nginx/sbin/nginx -s reload
重启
mysql
5.5.15编译安装速记 有几个东西要先安装
yum
install ncurses-devel
yum
install bison-devel
yum install libaio-devel
yum
install gcc-c++然后解压缩后,开始编译mysql5.5
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_UNIX_ADDR=/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS=all
-DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH_READLINE=1
-DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
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