zoukankan      html  css  js  c++  java
  • LNMP结合discuz的配置

    一、安装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
  • 相关阅读:
    Leetcode929.Unique Email Addresses独特的电子邮件地址
    Leetcode914.X of a Kind in a Deck of Cards卡牌分组
    new Date()设置日期在IOS的兼容问题
    koa2 使用passport权限认证中间件
    当 better-scroll 遇见 Vue
    百度地图开发
    通过Ajax方式上传文件,使用FormData进行Ajax请求
    app中页面滑动,防止a链接误触
    js判断是微信、QQ内置浏览器打开页面
    百度天气预报接口介绍
  • 原文地址:https://www.cnblogs.com/frankielf0921/p/5373035.html
Copyright © 2011-2022 走看看