LNMP 搭建起来后,安装DISUZ 操作记录


[root@LNMP ~]# mkdir /data/dis


[root@LNMP dis]# wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip



[root@LNMP ~]# vim /usr/local/nginx/conf/nginx.conf  #清空nginx.conf ,写入以下内容


user nobody nobody;

worker_processes 2;

error_log /usr/local/nginx/logs/nginx_error.log crit;

pid /usr/local/nginx/logs/nginx.pid;

worker_rlimit_nofile 51200;

events

{

    use epoll;

    worker_connections 6000;

}

http

{

        include mime.types;

        default_type application/octet-stream;

        server_names_hash_bucket_size 3526;

        server_names_hash_max_size 4096;

        log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]'

  '$host "$request_uri" $status'

    '"$http_referer" "$http_user_agent"';

    sendfile on;

    tcp_nopush on;

        keepalive_timeout 30;

    client_header_timeout 3m;

        client_body_timeout 3m;

        send_timeout 3m;

        connection_pool_size 256;

        client_header_buffer_size 1k;

    large_client_header_buffers 8 4k;

    request_pool_size 4k;

    output_buffers 4 32k;

    postpone_output 1460;

    client_max_body_size 10m;

        client_body_buffer_size 256k;

    client_body_temp_path /usr/local/nginx/client_body_temp;

        proxy_temp_path /usr/local/nginx/proxy_temp;

    fastcgi_temp_path /usr/local/nginx/fastcgi_temp;

    fastcgi_intercept_errors on;

    tcp_nodelay on;

    gzip on;

    gzip_min_length 1k;

    gzip_buffers 4 8k;

    gzip_comp_level 5;

    gzip_http_version 1.1;

        gzip_types text/plain application/x-javascript text/css text/htm application/xml;


server

{

    listen 80;

    server_name localhost;

        index index.html index.htm index.php;

        root /usr/local/nginx/html;

        location ~ \.php$ {

            include fastcgi_params;

            fastcgi_pass 127.0.0.1:9000;

            fastcgi_index index.php;

            fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;

        }

}

}


--------------------------------分割线----------------------------------------


将discuz 的安装到 /usr/local/nginx/html 目录下

 wKiom1gtxDvxKGrYAAFoYj_f1_0302.jpg 学友远程协助操作过程。截图如下wKiom1guzrmAzN7UAAA3iXK4x2U545.png


[root@LNMP ~]# vim /usr/local/nginx/conf/vhosts/linux.com                                            

server

{

    listen 80;

    server_name www.linux.com;

    index index.html index.htm index.php;

    root /data/dis;


    location ~ \.php$ {

        include fastcgi_params;

        #fastcgi_pass unix:/tmp/dis.sock;

        fastcgi_pass 127.0.0.1:9000;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME /data/dis$fastcgi_script_name;

    }


}

————————分割线---------------------------------------


在 c:\Windows\System32\drivers\etc 绑定 IP & 网址

192.168.31.165 www.linux.com 


wKiom1gtxgCi3hlDAAI_EQWTIws260.jpg

wKioL1gtxoeTiu2CAAEMHc1AeU8227.jpg

wKiom1gtxojwBuDQAACzfGTJxXk725.jpg



 同意安装后我们看多好多都是不可写,这时我们就要给他们赋予php-fpm用户权限。 



---------------------------------------------

[root@LNMP ~]# cd /usr/local/nginx/html/  #进入到目录下

[root@LNMP html]# chown -R php-fpm config data uc_client uc_server  #赋权

赋权后状状查看

drwxr-xr-x  2 php-fpm root 4096 Nov 18 07:34 config

drwxr-xr-x 13 php-fpm root 4096 Nov 18 07:34 data

drwxr-xr-x  6 php-fpm root 4096 Nov 17 22:34 uc_client

drwxr-xr-x 13 php-fpm root 4096 Nov 17 22:34 uc_server

----------------------------------------------

再新刷新网页,状态全部变成可写。接着进行下一步打操作。

wKioL1gt0yOw_dZWAAC_AmFLU-o541.jpg


选择全新安装

wKioL1gt0-rz5nkqAAD07Z3R7to092.jpg

接下来是设置 mysql,我们每次用自已安装的myqls

需要输入 /usr/local/mysql/bin/mysql,而不能直接输入mysql ,

那么我们就需更改 PATH

下来是设置 mysql,我们每次用自已安装的myqls

需要输入 /usr/local/mysql/bin/mysql,而不能直接输入mysql ,

那么我们就需更改 PATH

[root@OBird www]# which mysql (mysql不是/usr/local/mysql/bin/mysql,注意区分)

/usr/bin/mysql (系统自带的mysql)

用以下命令查找到系统自带的mysql,然后卸载,如果不卸载会和安装的mysql冲突。因为楼主已经卸载过,所以没有截图。

[root@OBird www]# rpm -qf /usr/local/mysql

file /usr/local/mysql is not owned by any package

编写一个path.sh 的脚本,创建mysql 快捷使用方式

[root@OBird www]# vim /etc/profile.d/path.sh

#!/bin/bash

export PATH=$PATH:/usr/local/mysql/bin


[root@OBird www]# source /etc/profile.d/path.sh


然后就可以使用了。

首先创建一个库

[root@OBird ~]# mysql

mysql> create database discuz;

Query OK, 1 row affected (0.20 sec)

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| test               |

+--------------------+


mysql> grant all on discuz.* to 'linux'@'localhost' identified by 'linux';

Query OK, 0 rows affected (0.16 sec)

数据库名:discuz ;数据库名:linux  PS:linux 

                  管理员admin ps :123456

wKioL1gt3DyjkFe-AAEsm3QI6kE711.jpg



wKioL1gt3OnRAizhAAHxn68cndI823.jpg

以下是访问界面:

wKioL1g_79mi-O0kAAIwa-drV2s702.jpg


###############################################################


此处于2016-12--01 补充


楼主在安装discuz 论坛以后,在配置 nginx 用户认证  ,nginx  指定文件日志类型,这两项配置没有达到实验效果。


只装一个论坛网站,不需要启用 include vhosts/*.conf;,所以最开始安装discuz 的时候没有启用 include vhosts/*.conf;但是此时php 的解析是在 nginx.conf  里面的。且 /usr/local/nginx/conf/vhosts/linux.conf 中也配置了php 解析。

后来楼主脑洞大开,就启用了  include vhosts/*.conf;再次刷新论坛的时候,提示安装discuz 。看到提示,于是楼主就再一次安装了discuz ,第一次安装的并没卸载或删除。安装完成后,楼主就注释掉了nginx.conf 中的php 解析。再次检测配置文件,且重新加载 nginx.

楼主原先配置的 用户认证,指定日志类型,全部生效。


以下附下配置文件内容

nginx.conf  配置文件内容

-----------

user nobody nobody;

worker_processes 2;

error_log /usr/local/nginx/logs/nginx_error.log crit;

pid /usr/local/nginx/logs/nginx.pid;

worker_rlimit_nofile 51200;

events

{

    use epoll;

    worker_connections 6000;

}

http

{

        include mime.types;

        default_type application/octet-stream;

        server_names_hash_bucket_size 3526;

        server_names_hash_max_size 4096;

        log_format linux '$remote_addr $http_x_forwarded_for [$time_local]'

  '$host "$request_uri" $status'

    '"$http_referer" "$http_user_agent"';

    sendfile on;

    tcp_nopush on;

        keepalive_timeout 30;

    client_header_timeout 3m;

        client_body_timeout 3m;

        send_timeout 3m;

        connection_pool_size 256;

        client_header_buffer_size 1k;

    large_client_header_buffers 8 4k;

    request_pool_size 4k;

    output_buffers 4 32k;

    postpone_output 1460;

    client_max_body_size 10m;

        client_body_buffer_size 256k;

    client_body_temp_path /usr/local/nginx/client_body_temp;

        proxy_temp_path /usr/local/nginx/proxy_temp;

    fastcgi_temp_path /usr/local/nginx/fastcgi_temp;

    fastcgi_intercept_errors on;

    tcp_nodelay on;

    gzip on;

    gzip_min_length 1k;

    gzip_buffers 4 8k;

    gzip_comp_level 5;

    gzip_http_version 1.1;

    gzip_types text/plain application/x-javascript text/css text/htm application/xml;

    include vhosts/*.conf;  #启用。没有启用之前,php 的解析是启用的,且可以解析。

                                  启用后就注释掉了。

#server

#{

#    listen 80;

#    server_name localhost;

#        index index.html index.htm index.php;

#        root /usr/local/nginx/html;

#        location ~ \.php$ {

#            include fastcgi_params;

#            fastcgi_pass unix:/tmp/dis.sock;

#           #fastcgi_pass 127.0.0.1:9000;

#            fastcgi_index index.php;

#            fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;

#        }

#}

}


linux.conf 虚拟机配置文件内容

-----------------------------

server

{

    listen 80;

    server_name www.linux.com www.test.com;

    if ($host != 'www.linux.com') {

       rewrite ^/(.*)$ http://www.linux.com/$1 permanent;

    }

    index index.html index.htm index.php;

    root /data/dis;

    access_log /usr/local/nginx/logs/access.log linux;


    location ~ .*admin\.php$ {  #用户认证配置

    auth_basic "auth";

    auth_basic_user_file /usr/local/nginx/conf/.htpasswd;

    include fastcgi_params;

    fastcgi_pass unix:/tmp/dis.sock;

    fastcgi_index index.php;

    fastcgi_param SCRIPT_FILENAME /data/dis$fastcgi_script_name;


    }


    location ~ .*\.(gif|jpeg|jpg|png|bmp|swf)$  #图片文件访问日志关闭配置

    {

          access_log off;

    }

    location ~(static|cache)

    {

             access_log off;

    }


    location ~ \.php$ {   # php解析

        include fastcgi_params;

        fastcgi_pass unix:/tmp/dis.sock;

        #fastcgi_pass 127.0.0.1:9000;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME /data/dis$fastcgi_script_name;


    }


}


--------------------------------------------------------------------------