一.配置解析php

编辑nginx配置文件/usr/local/nginx/conf/nginx.conf

[root@huh ~]# vim /usr/local/nginx/conf/nginx.conf

我们需要将php的配置行打开,找到这么几行:

        #location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

1.将"fastcgi_pass 127.0.0.1:9000;"改为“fastcgi_pass   unix:/tmp/www.sock;”

2.将“fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;”

改为"fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;"

改动后的结果:

        location ~ \.php$ {
root html;
fastcgi_pass unix:/tmp/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
include fastcgi_params;
}

注:1./usr/local/nginx/html是网站根目录的所在,网页只有放在这儿才能被找到

  2.php当前监听的套接字文件为/tmp/www.sock,nginx通过这个文件和php通信

二.检查nginx配置是否正确,重新加载nginx

[root@huh ~]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@huh ~]#
[root@huh ~]# /usr/local/nginx/sbin/nginx -s reload

三.关闭防火墙selinux和iptables

关闭selinux:

[root@huh ~]# vim /etc/selinux/config
将"SELINUX=enforcing"配置行改为"SELINUX=disabled",保存退出!
[root@huh ~]# getenforce
Enforcing

注:getenforce是临时关闭selinux的命令

清空iptables的filter表:

[root@huh ~]# iptables -F
[root@huh ~]# /etc/init.d/iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables: [确定]

注:1."iptables -F" 命令将iptables的默认表filter表清空。

  2."/etc/init.d/iptables save"将当前规则保存

四.测试解析php

测试能否访问web主页:

[root@huh ~]# curl localhost -I
HTTP/1.1 200 OK

我们也可以使用浏览器去访问,在浏览器中输服务器IP地址即可!本次实验虚拟机IP为192.168.199.226)

测试解析php:

[root@huh ~]# cd /usr/local/nginx/html/
[root@huh html]# vim info.php
写入内容为:
<?php
    phpinfo();
?>

访问php文件:

http://192.168.199.226/info.php

php文件加载成功!

五.安装Discuz

下载解压discuz:

[root@huh ~]# mkdir /data/www
[root@huh ~]# cd /data/www
[root@huh www]# wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
[root@huh www]# unzip Discuz_X3.2_SC_GBK.zip
[root@huh www]# mv upload/* ./
[root@huh www]# rm -rf readme/ utility/ upload/ Discuz_X3.2_SC_GBK.zip

修改nginx配置文件,将其默认访问目录为/data/www:

[root@huh www]# vim /usr/local/nginx/conf/nginx.conf

1.找到如下配置行:

        location / {
root html;
index index.html index.htm;
}

并将其改为:

        root   /data/www;
index index.html index.htm index.php;

2.找到配置行"            fastcgi_param  SCRIPT_FILENAME  /usr/local/nginx/html$fastcgi_script_name;"将其中的/usr/local/nginx/html替换为/data/www

保存退出!

[root@huh www]# /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[root@huh www]# /usr/local/nginx/sbin/nginx -s reload

浏览器再次使用ip地址访问,开始安装discuz!

六.discuz在web上的配置

1.显示Discuz安装向导后,点击我同意

2.在服务器上执行如下命令,将那些红叉消除:

[root@huh www]# cd /data/www/
[root@huh www]# chown -R php-fpm config data uc_client/data uc_server/data

3.点击下一步

4.选择全新安装discuz,点击下一步

5.在mysql上创建数据库和用户:

[root@huh ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
mysql> create database discuz;
Query OK, 1 row affected (0.00 sec) mysql> grant all on discuz.* to 'huh'@'localhost' identified by '123456';
Query OK, 0 rows affected (0.01 sec) mysql> quit
Bye

6.填写数据库信息和管理员信息:

填写数据库信息:
  数据库服务器:localhost
  数据库名:discuz
  数据库用户名:huh
  数据库密码:123456
  ***(其它保持不变)
填写管理员信息
  管理员账号:admin
  管理员密码:123456
  重复密码:123456

安装成功!

最新文章

  1. poj 1737男人八题之一 orz ltc
  2. PL/SQL EO 设计与开发
  3. ios 关于状态栏的一些小知识
  4. php方法 隐藏手机号中间四位
  5. 20145207《Java程序设计》第7周学习总结
  6. HDOJ-1042 N!(大数乘法)
  7. STM32F207V 进行DS18B20处理
  8. base 镜像 - 每天5分钟玩转容器技术(10)
  9. npm 使用 taobao 的镜像后,无法 login &amp; publish
  10. Linux内存管理 (23)一个内存Oops解析
  11. mysql-xtrabackup备份sh: xtrabackup_56: command not found与error while loading shared libraries: libssl.so.6: cannot open shared object file: No such file or directory
  12. 随select动,将value值显示在后面的input里
  13. linux 应用和发展
  14. ibeacon和蓝牙有什么区别_它们的区别在哪里
  15. openpose pytorch代码分析
  16. Java中变量之局部变量、本类成员变量、父类成员变量的访问方法
  17. git初学 常用命令
  18. python中的and和or用法
  19. MySQL异步复制延迟解决
  20. python之模块datetime 常见操作

热门文章

  1. 详解PHP输入流php://input
  2. C++如何调用C#开发的dll
  3. ASP.NET MVC post请求接收参数的三种方式
  4. VS2013设置护眼背景颜色
  5. ASP.NET MVC 之自定义HtmlHelper
  6. ASP.NET Core开发-获取所有注入(DI)服务
  7. healthMonitoring与运行状况监视
  8. 谈一谈.net析构函数对垃圾回收的影响
  9. Java基础知识笔记(六:网络程序设计)
  10. PHP工作笔记:使用yii migrate管理、生成数据库