Nginx+Php+Discuz配置
环境
Centos 5.2、Pcre、Nginx-0.7.61、mysql-5.1.35、PHP、Discuz 7.1
软件下载地址:
安装步骤:
1、nginx需要安装pcre库
tar -zxvf pcre-7.8.tar.gz
./configure
make && make install
./configure
make && make install
2、Nginx 安装
tar zxvf nginx-0.7.61.tar.gz
./configure --prefix=/usr/local/nginx --with-http_stub_status_module
make && make install
mysql安装见
http://cqfish.blog.51cto.com/622299/158841
./configure --prefix=/usr/local/nginx --with-http_stub_status_module
make && make install
3、安装PHP
利用系统自带的yum 工具进行安装
yum install php php-mysql
php-mysql是让php支持mysql数据库,如果不安装php程序无法连接到mysql数据库.
4、配置Discuz
配置nginx.conf
添加以下几行
server {
listen 80;
server_name www.test.com ;
location / {
root upload;
index index.php index.html index.htm;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/upload$fastcgi_script_name;
include fastcgi_params;
}
listen 80;
server_name www.test.com ;
location / {
root upload;
index index.php index.html index.htm;
}
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/upload$fastcgi_script_name;
include fastcgi_params;
}
}
上传discuz 文件到/usr/local/nginx/upload
创建discuz mysql用户
mysql>grant alter,drop,create,select,update,insert,delete on discuz.* to 'dzbbs'@'127.0.0.1' identified by 'dzbbs';
注:'dzbbs'@'127.0.0.1' @后边得是IP形式,如果是localhost这样,在安装discuz的时候,页面通不过.
discuz安装页面,选择数据库地址也得填写IP地址才行.
启动php
利用lighttpd服务器中的spawn-fcgi来启动php
从其它安装了lighttpd服务器复制spawn-fcgi文件
spawn-fcgi -a 127.0.0.1 -p 9000 -C 5 -f /usr/bin/php-cgi
-P 表示端口
-c 表示进程数
通过
http://localhost/install
进行安装discuz,根据提示安装,直到完成!
转载于:https://blog.51cto.com/cqfish/184154