第一步:
安装redis3.0.2:
下载安装包并解压:
tar-zxvf redis-3.0.2.tar.gz
yuminstall gcc gcc-c++ cmake make automake tcl –y
makeMALLOC=libc
cd src && make test (建议测试)
makeinstall (生成redis命令)l
cdutils && ./install_server.sh 按照交互命令配置即可
配置 redis.conf
可以设置成daemonizeyes
第二步:
基本要求如图:
安装nginx
创建nginx用户和组
Groupaddnginx
Useradd–g nginx nginx
Yuminstall –y pcre-devel openssl-devel
下载并解压nginx 和nginx 的两个流媒体第三方模块
Wget
tar –zxvf nginx_mod_h264_streaming-2.2.7.tar.gz
unzipngx_cache_purge-master.zip
unzipnginx-rtmp-module-master.zip
tar -zxvf nginx-1.2.1.tar.gz
cdnginx-1.2.1
./configure--prefix=/usr/local/nginx --user=nginx --group=nginx--add-module=../nginx-rtmp-module-master --add-module=../ngx_cache_purge-master--add-module=../nginx_mod_h264_streaming-2.2.7 --with-http_stub_status_module--with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module--with-http_flv_module --with-http_secure_link_module
Make
Make 中可能遇到问题:/root/nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c:In function ‘ngx_streaming_handler’:/root/nginx_mod_h264_streaming-2.2.7/src/ngx_http_streaming_module.c:158:error: ‘ngx_http_request_t’ has no member named ‘zero_in_uri’make[1]: *** [objs/addon/src/ngx_http_h264_streaming_module.o]Error 1make[1]: Leaving directory `/root/nnginx-1.5.9'make: *** [build] Error 2那么将src/ngx_http_streaming_module.c文件中以下代码删除或者是注释掉就可以了:/* TODO: Win32 */if (r->zero_in_uri){ return NGX_DECLINED;}
Make install 成功安装
安装mysql:
解压mysql:
tar-zxvf mysql-5.5.51.tar.gz
cdmysql-5.5.51
yuminstall ncurses-devel -y
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql/mysql.sock -DDEFAULT_CHARSET=utf8-DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=utf8,gbk-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
make && make install
cp surpport-files/my-medium.cnf /etc/my.cnf
3.2 初始化数据库
scripts/mysql_install_db --user=mysql –basedir=/usr/local/mysql–datadir=/usr/local/mysql/data
请注意使用这个support下面的脚本文件,不要使用编译目录中的support-file中的
Cd /usr/local/mysql
cp surpport-files/mysql.server/etc/init.d/mysqld
chmod 755 /etc/init.d/mysql
ln –s /usr/local/mysql/bin/* /usr/bin/
启动之前建议在修改两个文件中/etc/my.cnf 和 /etc/init.d/mysqld 中basedir 和datadir参数
例如:
Basedir=/usr/local/mysql
Datadir=/usr/local/mysql/data
还有就是mysql.sock 的client端和mysqld 端应该一致如都指向
mysql.sock = /tmp/mysql.sock
不然启动的时候会报错:
/etc/init.d/mysql start
使用mysqladmin创建root用户密码(注意先启动服务后才能重置密码)
如:
mysqladmin -u root password '123456'
mysql 安装完毕!!
php 安装:
下载并解压php5.5.35
tar-zxvf php-5.5.35.tar.gz
准备php 编译条件:
groupadd www
useradd –g www www
Yum install freetype-devel openssl-devel libxml2-devellibjpeg-devel libpng-devel curl-devel -y
开始编译:
cd php-5.5.35
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv-dir --with-freetype-dir=/usr/local/freetype --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-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-gettext --disable-fileinfo --enable-opcache–-with-curl=/usr/local/curl
如果报错: vim /etc/ld.so.conf.d/local.conf
/usr/local/lib64 (64位os)
/usr/local/lib(i386os)
然后 ldconfig –v
再次编译就好了
# cp php.ini-development/usr/local/php/lib/php.ini
# cp/usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp/usr/local/php/etc/php-fpm.d/www.conf.default/usr/local/php/etc/php-fpm.d/www.conf
# cp -R ./sapi/fpm/php-fpm/etc/init.d/php-fpm
测试:
端口监听正常即可
最后一步:配置nginx 的php fastcgi:
我这里配置的是vhost 域名主机版本
1. 首先将主配置文件nginx.conf下做一些全局的参数,我这里就不配置了
2. 将主配置文件中的server全部注释
3. 在主配置文件的末尾引入 vhost即:
4. 测试一下配置文件:
5. 在conf目录下新建vhost 目录 并将所有者和所属组设置成www
Mkdir /usr/local/nginx/conf/vhost && chown –Rwww:www /usr/local/nginx/conf/vhost
6. 在vhost 目录下 vim 一个新的域名主机 名字随便起,我就叫default.conf
6. 再次测试 配置文件的正确性
7. 在项目下写一段phpinfo()函数的文件并启动或重启nginx测试
8 测试结果:
Ok!! 今天完工。明天继续,睡觉!! 晚安!!