Chinaunix首页 | 论坛 | 博客
  • 博客访问: 104149
  • 博文数量: 22
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 235
  • 用 户 组: 普通用户
  • 注册时间: 2014-05-15 21:44
个人简介

Just start from your heart.

文章分类

全部博文(22)

文章存档

2015年(5)

2014年(17)

我的朋友

分类: LINUX

2014-05-15 22:31:54

环境:centOS6.5
1、安装MySQL和PHP连接MySQL数据库的包:

yum -y install mysql mysql-server php-mysql

2.安装nginx,php-fpm,因为centos官方没有php-fpm的rpm包,需要再找一个网络YUM源:

wget -O /etc/yum.repos.d/CentOS-Base.repo
yum install nginx php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml
php-xmlrpc php-pear php-pecl-memcache php-eaccelerator 

3.安装MySQL的常用扩展包:

yum -y install mysql-connector-odbc mysql-devel libdbi-dbd-mysql


4. 上面3步安装完成之后,直接就可以启动 nginx  php-fpm   mysql
    service nginx start
    service php-fpm start
    service mysqld start
    启动nginx时报错:nginx: unrecognized service
    解决办法:nginx服务没有安装,下载本地的nginx安装包:
    本地没有上传命令,用yum安装本地上传下载命令:yum -y install lrzsz
    rz  上传nginx安装包和GeoIP
    解压GeoIP包:tar zxvf GeoIP-1.4.6.tar.gz 
    编译安装GeoIP: ./configure   make   make install
    ./configure报错:checking for gcc... no
                    checking for cc... no
                    checking for cl.exe... no
                    configure: error: no acceptable C compiler found in $PATH
                    See `config.log' for more details.
    解决办法:用yum安装gcc
             yum  -y install gcc
  用rpm安装nginx安装包:
    rpm -ivh nginx-1.5.12-1.el6.x86_64.rpm  --nodeps
 再重新启动nginx  php-fpm   mysql
    nginx启动时报错:Starting nginx: /usr/sbin/nginx: error while loading shared libraries: libGeoIP.so.1: cannot open shared object file: No such file or directory
    还是依赖关系的问题解决办法:
    vim /etc/ld.so.conf
    添加 /usr/local/lib                      -------添加依赖包
    ldconfig -f /etc/ld.so.conf              ------重新加载此文件
    ldconfig -v                               ------查看依赖包关系
    service  nginx start

5.在/etc/nginx/nginx.conf配置文件中把php配置项打开:
需要改两个地方
root /usr/share/nginx/html;
解决php解析    No input file specified. 问题   
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;      
解决nginx报错问题                                   
location ~ \.php$ {
                root /usr/share/nginx/html; #这里要改成网站根目录不然会出现 No input file specified.                       
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # 这里要改下替换原来/scripts$fastcgi_script_name;
                include fastcgi_params;
            }

然后重启nginx
nginx -t
 service nginx restart


验证网站是否可以打开:

6/安装DEDECMS:
(1)/下载DEDECMS的安装包:rz
(2)/解压DedeCMS的安装包: tar zxvf DedeCMS-V5.7-UTF8-SP1.tar.gz 
(3)/进入DedeCMS-V5.7-UTF8-SP1目录,将uploads重命名:mv uploads/ web
(4)/修改nginx配置:将include /etc/nginx/conf/*.conf;修改为include /etc/nginx/vhost/*.conf;
(5)/创建vhost的目录:mkdir vhost
(6)/编辑vhost目录下web.conf :
server{
listen 82;                  ------监听的端口
server_name          -----域名
root  /www/web;                   ----网站目录
index index.html index.php;        -----默认文档


   location ~ \.php$ {               -----php的配置
                fastcgi_pass 127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # 这里要改下替换原来/scripts$fastcgi_script_name;
                include fastcgi_params;
            }

}
(7)/检查nginx的配置:nginx -t
(8)/重新启动nginx:service nginx reload
(9)/创建www目录并把web目录移过去:mkdir www    mv /usr/share/nginx/html/web/ www/


验证dedecms后台是否安装成功:

阅读(2133) | 评论(0) | 转发(0) |
0

上一篇:linux last命令总结

下一篇:nginx 负载均衡

给主人留下些什么吧!~~