yum搭建lnmp+redis环境
这里整理下安装较新版本的 php5.6和mysql5.6
nginx
rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm yum install nginx -y
可能需要修改配置文件
cp /etc/nginx/fastcgi_params /etc/nginx/fastcgi.conf vim /etc/nginx/fastcgi.conf // 顶部追加 fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
可能使用rewrite的nginx配置文件
server { listen 80; server_name wd.cleey.com; index index.php index.html index.shtml; root /path/www/web; location /{ if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } } location ~ \.php($|/) { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^(.+\.php)(/.*)$; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi.conf; } }
php 5.6
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm yum install php56w
以后安装php的东西记着使用 php56w比如
yum install php56w-mbstring php56w-opcache php56w-devel php56w-mysql
mysql5.6
可以参考官网 http://dev.mysql.com/downloads/repo/yum/
rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el6-8.noarch.rpm
修改mysql源,默认安装5.6版本,下载的默认是5.7的版本。
vim /etc/yum.repos.d/mysql-community.repo
修改汉字部分
# Enable to use MySQL 5.6 [mysql56-community] name=MySQL 5.6 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/ enabled=1 <-------- 注意这儿 改为1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql [mysql57-community] name=MySQL 5.7 Community Server baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/ enabled=0 <-------- 注意这儿 改为0 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
最后保存安装mysql
yum install mysql-community-server service mysqld start // 修改密码 mysqladmin -u root -p password '新密码' // 登录 mysql -uroot -p
redis
rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm yum install redis service redis start // 连接客户端 redis-cli
也可以编译安装
wget http://download.redis.io/releases/redis-2.8.19.tar.gz tar -zxvf redis-2.8.19.tar.gz cd redis-2.8.19 make && make install
安装好redis后,还需要安装 php-redis扩展
这个看这儿吧 /blog/single/id/715.html