码迷,mamicode.com
首页 > Web开发 > 详细

LNMP结合discuz的配置

时间:2016-04-15 21:28:02      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:

一、安装discuz

配置参照LAMP结合discuz的第一部分

 不要忘记了 添加hosts~!!!!

===============我是分割线。==========================

二、nginx与discuz结合

[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
//将server以及其对应的括号删除
...
...
server
{
    listen 80;
...  {
...
}
}
//在最后一个括号前加入,让nginx能够执行vhosts文件夹里配置的conf
include /usr/local/nginx/conf/vhosts/*.conf;
}

[root@localhost ~]# /usr/local/nginx/sbin/nginx -t  
[root@localhost ~]# cd /usr/local/nginx/conf
[root@localhost conf]# mkdir vhosts
[root@localhost vhosts]# vim default.conf  //配置虚拟主机
//加入内容
server
{
        listen 80 default_server;
        server_name 123.com;
        index index.html index.htm index.php;
        root /tmp/tmp;
}

[root@localhost vhosts]# mkdir /tmp/tmp

//测试
/*设置虚拟主机后,什么网站都是403*/
[root@localhost vhosts]# curl -x127.0.0.1:80 www.baidu.com -I
HTTP/1.1 403 Forbidden
Server: nginx/1.4.4
Date: Sun, 10 Apr 2016 20:57:34 GMT
Content-Type: text/html
Content-Length: 168
Connection: keep-alive

[root@localhost vhosts]# curl -x127.0.0.1:80 www.qq.com -I 
HTTP/1.1 403 Forbidden
Server: nginx/1.4.4
Date: Sun, 10 Apr 2016 20:57:41 GMT
Content-Type: text/html
Content-Length: 168
Connection: keep-alive

//设置discuz
[root@localhost vhosts]# vim test.conf
server
{
        listen 80;
        server_name test.com;
        index index.html index.htm index.php;
        root /data/www;

        location ~ \.php$ {
        include fastcgi_params;
        #fastcgi_pass unix:/tmp/php-fcgi.sock;
        #这里常使用127.0.0.1:9000来配置  
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
    }
[root@localhost vhosts]# /usr/local/nginx/sbin/nginx -t //检测
//还需要修改php-fpm
[root@localhost vhosts]# vim /usr/local/php/etc/php-fpm.conf
...
...
[www]
listen = /tmp/php-fcgi.sock  //修改为 listen = 127.0.0.1:9000
...
...
[root@localhost vhosts]# /usr/local/php/sbin/php-fpm -t //检测是否有错误
[root@localhost vhosts]# service php-fpm restart
[root@localhost vhosts]# service nginx restart
[root@localhost vhosts]# curl -x127.0.0.1:80 test.com -I
HTTP/1.1 301 Moved Permanently
Server: nginx/1.4.4
Date: Sun, 10 Apr 2016 21:21:07 GMT
Content-Type: text/html
Connection: keep-alive
X-Powered-By: PHP/5.3.27
location: install

//success

 

LNMP结合discuz的配置

标签:

原文地址:http://www.cnblogs.com/frankielf0921/p/5373035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!