LNMP+tomcat部署discuz、dedecms及zrlog

Stella981
• 阅读 1308

文章目录

搭建lnmp

Mysql的安装

· 移动到安装包存放路径:

cd /usr/local/src/

· 下载MySQL的二进制免编译包:

wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

·解压mysql源码包文件:

tar -zxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz

·移动解压后的目录并更名:

mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql

·移动至mysql目录下:

cd /usr/local/mysql

·创建一个新用户:

useradd mysql

·创建datadir的目录:

mkdir /data/

·初始化mysql,指定用户和data目录:

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql
安装需要的依赖包:yum install -y perl-DBD-MySQL libaio*

·修改mysql的配置文件(系统自带):

vim /etc/my.cnf
· 修改内容如下:
datadir=/data/mysql
socket=/tmp/mysql.sock

· 将mysql自带的脚本文件移至chkconfig的执行目录下,并定义basedir(程序目录)和datadir:

cp support-files/mysql.server /etc/init.d/mysqld

· 定义脚本中的basedir(程序目录)和datadir:

basedir=/usr/local/mysql
datadir=/data/mysql

· 将脚本文件的权限更改为755:

chmod 755 /etc/init.d/mysqld

· 将脚本文件加入到chkconfig服务中:

chkconfig --add mysqld

· 启动mysql服务

/etc/init.d/mysqld start

PHP安装

· 相关的依赖包:

yum -y install libxml2-devel libpng-devel openssl openssl-devel bzip2 bzip2-devel libjpeg-devel freetype-devel libmcrypt.x86_64  libmcrypt-devel.x86_64  curl curl-devel

· 移动到安装包存放路径:

cd /usr/local/src/

· 下载php5源码包:

wget http://cn2.php.net/distributions/php-5.6.32.tar.bz2

· 解压php5源码包

tar -jxvf php-5.6.32.tar.bz2

· 移至解压后的目录下执行命令:

./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl  --with-openssl

· 最后进行编译和安装:

make && make install

· 创建php-fpm用户:

useradd -s /sbin/nologin -M php-fpm

· 复制解压目录中的配置模板到php-fpm目录下:

cp php.ini-production /usr/local/php-fpm/etc/php.ini

· 创建并修改主配置文件:

vim /usr/local/php-fpm/etc/php-fpm.conf
加入以下内容:
[global]
pid = /usr/local/php-fpm/var/run/php-fpm.pid
error_log = /usr/local/php-fpm/var/log/php-fpm.log
include = /etc/php/php-fpm.d/*.conf

· 创建php-fpm配置文件目录

mkdir -p /etc/php/php-fpm.d/

· 添加discuz论坛的php-fpm配置文件:

vim /etc/php/php-fpm.d/discuz.conf
[discuz]
listen = /tmp/discuz.sock
listen.mode=666
user = php-fpm
group = php-fpm
pm = static
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 1
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
request_slowlog_timeout = 2                                      
slowlog = /usr/local/php-fpm/var/log/discuz-slow.log

· 添加dedecms论坛的php-fpm配置文件:

vim /etc/php/php-fpm.d/dedecms.conf
内容如下:
[dedecms]
listen = /tmp/dedecms.sock
listen.mode=666
user = php-fpm
group = php-fpm
pm = static
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 1
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
request_slowlog_timeout = 2                                 
slowlog = /usr/local/php-fpm/var/log/dedecms-slow.log

· 定时自动切割php-fpm的日志脚本

vim /usr/local/sbin/php-fpm_logrotate.sh
#! /bin/bash
#php-fpm的日志存放路径为/usr/local/php-fpm/var/log/
d=`date -d "-1 day" +%Y%m%d`
logdir="/usr/local/php-fpm/var/log/"
cd $logdir
for log in `ls *.log`
do
mv $log $log-$d
done
##3 自动删除一个月以前的日志
find /usr/local/php-fpm/var/log/ -name discuz-slow.log-* -type f –mtime +30 |xargs rm

· 创建php-fpm_logrotate.sh的日志计划任务

crontab -e
0 0 * * * /bin/bash /usr/local/sbin/discuz-php-fpm_logrotate.sh &>>/tmp/php-fpm_logrotate.log

· 复制解压后的源码包中的启动脚本:

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

· 修改启动脚本权限:

chmod 755 /etc/init.d/php-fpm

· 将脚本文件加入到chkconfig服务中:

chkconfig --add php-fpm

· 设置开机启动php-fpm:

chkconfig php-fpm on

· 查看配置文件是否正确:

/usr/local/php-fpm/sbin/php-fpm -t

· 启动php-fpm服务:

service php-fpm start

· 测试服务是否启动成功:

ps aux |grep php-fpm

Nginx安装

· 移动至目录

cd /usr/local/src

· 下载Nginx1.14版本:

wget http://nginx.org/download/nginx-1.14.0.tar.gz

· 解压源码包:

tar zxvf nginx-1.14.0.tar.gz

· 相关依赖包

yum -y install gcc* autoconf libjpeg* libpng* freetype* libxml2* zlib* glibc* glib2* bzip2* ncurses* curl* e2fsprogs* krb5* libidn-devel openssl* openldap* nss_ldap

· 移至解压后的cd nginx-1.14.0目录下执行命令:

./configure --prefix=/usr/local/nginx

· 编译安装nginx:

make && make install

· 创建编辑nginx启动脚本:

vim /etc/init.d/nginx
内容如下:
#!/bin/bash
# chkconfig: - 30 21
# description: http service.
# Source Function Library
. /etc/init.d/functions
# Nginx Settings

NGINX_SBIN="/usr/local/nginx/sbin/nginx"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/nginx/logs/nginx.pid"
RETVAL=0
prog="Nginx"

start() 
{
   
    echo -n $"Starting $prog: "
    mkdir -p /dev/shm/nginx_temp
    daemon $NGINX_SBIN -c $NGINX_CONF
    RETVAL=$?
    echo
    return $RETVAL
}

stop() 
{
   
    echo -n $"Stopping $prog: "
    killproc -p $NGINX_PID $NGINX_SBIN -TERM
    rm -rf /dev/shm/nginx_temp
    RETVAL=$?
    echo
    return $RETVAL
}

reload()
{
   
    echo -n $"Reloading $prog: "
    killproc -p $NGINX_PID $NGINX_SBIN -HUP
    RETVAL=$?
    echo
    return $RETVAL
}

restart()
{
   
    stop
    start
}

configtest()
{
   
    $NGINX_SBIN -c $NGINX_CONF -t
    return 0
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  reload)
        reload
        ;;
  restart)
        restart
        ;;
  configtest)
        configtest
        ;;
  *)
        echo $"Usage: $0 {start|stop|reload|restart|configtest}"
        RETVAL=1
esac

exit $RETVAL

· 修改nginx启动脚本权限:

chmod 755 /etc/init.d/nginx

· 将nginx启动脚本文件加入到chkconfig服务中:

chkconfig --add nginx

· 将nginx启动脚本设置为开机启动:

chkconfig nginx on

· 创建nginx主配置文件

vim /usr/local/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;
    include vhost/*.conf;
}

· 创建虚拟主机配置目录

mkdir /usr/local/nginx/conf/vhost/

· 创建discuz的虚拟主机配置文件

vim /usr/local/nginx/conf/vhost/discuz.conf
内容如下:
server
{
   
    listen 80;
    server_name discuz.yuankeedu.com;
    index index.html index.htm index.php;
    root /data/wwwroot/discuz.com;
     location ~ admin\.php
    {
   
        auth_basic              "Auth";
        auth_basic_user_file   /usr/local/nginx/conf/htpasswd;
        include fastcgi_params;
        fastcgi_pass unix:/tmp/discuz.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME   /data/wwwroot/discuz.com$fastcgi_script_name;
    }
    location ~ \.php$
    {
   
        include fastcgi_params;
        fastcgi_pass unix:/tmp/discuz.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME     /data/wwwroot/discuz.com$fastcgi_script_name;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$    
    {
   
          expires      7d;           
          access_log off;
    }
location ~ .*\.(js|css)$
    {
   
          expires      12h;     
          access_log off;
    }
    access_log /usr/local/nginx/logs/discuz.logs "combined_realip";
}

· 创建dedecms的虚拟主机配置文件

vim /usr/local/nginx/conf/vhost/dedecms.conf
内容如下:
server
{
   
    listen 80;
    server_name dedecms.yuankeedu.com;
    index index.html index.htm index.php;
    root /data/wwwroot/dedecms.com;
   location ~ login\.php
    {
   
        auth_basic              "Auth";
        auth_basic_user_file   /usr/local/nginx/conf/htpasswd;
        include fastcgi_params;
        fastcgi_pass unix:/tmp/dedecms.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME   /data/wwwroot/dedecms.com$fastcgi_script_name;
    }
    location ~ \.php$
    {
   
        include fastcgi_params;
        fastcgi_pass unix:/tmp/dedecms.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME     /data/wwwroot/dedecms.com$fastcgi_script_name;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$    
    {
   
          expires      7d;           
          access_log off;
    }
location ~ .*\.(js|css)$
    {
   
          expires      12h;     
          access_log off;
    }
    access_log /usr/local/nginx/logs/dedecms.logs "combined_realip";
}

· 创建zrlog的虚拟主机配置文件

vim /usr/local/nginx/conf/vhost/zrlog.conf
内容如下:
upstream cxsw.xyz
{
   
    ip_hash;
    server localhost:8080;
}
server
{
   
    listen 80;
    server_name zrlog.yuankeedu.com;
    location /
    {
   
        proxy_pass      http://localhost:8080;
        proxy_set_header Host   $host;
        proxy_set_header X-Real-IP      $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
    location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$    
    {
   
        expires      7d;         
        access_log off;
        proxy_pass      http://localhost:8080;
        proxy_set_header Host   $host;
        proxy_set_header X-Real-IP      $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    }
location ~ .*\.(js|css)$
    {
   
          expires      12h;     
          access_log off;
        proxy_pass      http://localhost:8080;
        proxy_set_header Host   $host;
        proxy_set_header X-Real-IP      $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    }
    access_log /usr/local/nginx/logs/zrlog.logs "combined_realip";
}

· 创建nginx的日志切割脚本

vim /usr/local/sbin/nginx_logrotate.sh
内容如下:
#!/bin/bash
d=`date -d "-1 day" +%Y%m%d`    
logdir="/usr/local/nginx/logs/"                                              
nginx_pid="/usr/local/nginx/logs/nginx.pid" 
cd $logdir                                                  
for log in `ls *.logs`                         
do
    mv $log $log-$d                                
done
/bin/kill -HUP `cat $nginx_pid`

· 创建nginx_logrotate.sh的计划任务

crontab -e
0 0 * * * /bin/bash /usr/local/sbin/nginx_logrotate.sh &>>/tmp/nginx_logrotate.log &>>/nginx_logrotate.log

· 检查配置nginx配置是否正确

/usr/local/nginx/sbin/nginx -t

· 启动nginx

/etc/init.d/nginx start

搭建tomcat+jdk

jdk的安装

· 前往ORACLE官网下载jdk,版本为1.8:

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

· 下载完成后,使用xftp等工具上传到服务器/usr/local/src/目录下。

· 解压jdk压缩包

tar zxvf jdk-8u181-linux-x64.tar.gz

· 移动解压后的jdk文件:

mv jdk1.8.0_181/ /usr/local/jdk1.8

· 设置jdk环境变量:

vim /etc/profile 
在文件最好加入以下内容:
JAVA_HOME=/usr/local/jdk1.8/
JAVA_BIN=/usr/local/jdk1.8/bin
JRE_HOME=/usr/local/jdk1.8/jre
PATH=$PATH:/usr/local/jdk1.8/bin:/usr/local/jdk1.8/jre/bin
CLASSPATH=/usr/local/jdk1.8/jre/lib:/usr/local/jdk1.8/lib:/usr/local/jdk1.8/jre/lib

· 加载jdk环境变量生效:

source /etc/profile

· 检验jdk环境是否生效:

java -version

tomcat的安装

· 移动至/usr/local/src目录下,下载tomcat免编译包:

wget https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-8/v8.5.34/bin/apache-tomcat-8.5.34.tar.gz

· 解压tomcat的压缩包:

tar zxvf apache-tomcat-8.5.34.tar.gz

· 移动解压后的tomcat目录:

mv apache-tomcat-8.5.34 /usr/local/tomcat

· 启动tomcat:/usr/local/tomcat/bin/startup.sh

配置mycat

· 编辑mycat主配置文件

vim /usr/local/mycat/conf/schema.xml
内容如下:
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">

        <schema name="TESTDB" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1"> </schema>
        <schema name="TESTDB1" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn2"> </schema>
        <schema name="TESTDB2" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn3"> </schema>
        <dataNode name="dn1" dataHost="localhost1" database="zrlog" />
        <dataNode name="dn2" dataHost="localhost2" database="discuz" />
        <dataNode name="dn3" dataHost="localhost3" database="dedecms" />
        <dataHost name="localhost1" maxCon="1000" minCon="10" balance="1"
                          writeType="0" dbType="mysql" dbDriver="native" switchType="2"  slaveThreshold="100">
                <heartbeat>select user()</heartbeat>
           <writeHost host="hostM1" url="192.168.118.170:3306" user="zrlog" password="zrlog">
        <readHost host="hostS1" url="192.168.118.171:3306" user="zrlog" password="zrlog" />
    </writeHost>
     </dataHost>
     <dataHost name="localhost2" maxCon="1000" minCon="10" balance="1"
                          writeType="0" dbType="mysql" dbDriver="native" switchType="2"  slaveThreshold="100">
                <heartbeat>select user()</heartbeat>
           <writeHost host="hostM2" url="192.168.118.170:3306" user="discuz" password="discuz">
        <readHost host="hostS2" url="192.168.118.171:3306" user="discuz" password="discuz" />
    </writeHost>
     </dataHost>
     <dataHost name="localhost3" maxCon="1000" minCon="10" balance="1"
                          writeType="0" dbType="mysql" dbDriver="native" switchType="2"  slaveThreshold="100">
                <heartbeat>select user()</heartbeat>
           <writeHost host="hostM3" url="192.168.118.170:3306" user="dedecms" password="dedecms">
        <readHost host="hostS3" url="192.168.118.171:3306" user="dedecms" password="dedecms" />
    </writeHost>
     </dataHost>
</mycat:schema>

· 编辑mycat的server.xml用户文件

vim /usr/local/mycat/conf/server.xml
在文件内增加内容如下:
<user name="zrlog">
                <property name="password">zrlog</property>
                <property name="schemas">TESTDB</property>
        </user>

        <user name="discuz">
                <property name="password">discuz</property>
                <property name="schemas">TESTDB1</property>
        </user>
        <user name="dedecms">
                <property name="password">dedecms</property>
                <property name="schemas">TESTDB2</property>
        </user>

· 重新启动mycat

/usr/local/mycat/bin/mycat restart

· 检查进程和端口是否启动

netstat -lntp |grep mycat;ps aux |grep mycat

部署zrlog

· 编辑tomcat配置文件:

vim /usr/local/tomcat/conf/server.xml
增加以下内容:
<Host name="zrlog.yuankeedu.com" appBase=""
    unpackWARs= "true" autoDeploy="true"
    xmlValidation="false" xmlNamespaceAware="false">
    <Context path="" docBase="/data/wwwroot/zrlog.com/" debug="0" reloadable="true" crossContext="true"/>
</Host>

· 下载zrlog(移动至/usr/local/src下):

wget http://dl.zrlog.com/release/zrlog-1.7.1-baaecb9-release.war

· 创建zrlog的网站根目录

mkdir -p /data/wwwroot/zrlog.com/

· 更名并移动zrlog的war包到/usr/local/tomcat/webapps/目录下:

cp zrlog-1.7.1-baaecb9-release.war /usr/local/tomcat/webapps/zrlog.war

· 移动到目录/usr/local/tomcat/webapps/,移动解压后的zrlog下的文件,删除zrlog和zrlog.war

mv /usr/local/tomcat/webapps/zrlog/* /data/wwwroot/zrlog.com/
rm -rfv zrlog zrlog.war

· 连接mysql后创建zrlog数据库,以及zrlog数据库用户

mysql -uroot -p
create database zrlog;
grant all on zrlog.* to 'zrlog'@'%' identified by 'zrlog';

· 重启动tomcat:

/usr/local/tomcat/bin/shutdown.sh && /usr/local/tomcat/bin/startup.sh

· 游览器访问域名,根据提示安装即可

数据库服务器:192.168.118.169
数据库名:TESTDB
数据库用户名:zrlog
数据库密码:zrlog
数据库端口:8066

zrlog的后台二次认证

· 修改tomcat根目录下的tomcat-users.xml文件

vim /usr/local/tomcat/conf/tomcat-users.xml
增加内容如下:
<role rolename="zrolg"/>
<user username="zrlog" password="zrlog" roles="tomcat"/>

· 修改tomcat根目录下的web.xml文件

vim /usr/local/tomcat/conf/web.xml
增加内容如下:
<security-constraint>
<web-resource-collection>
<web-resource-name>zrlog.yuankeedu.com</web-resource-name>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<auth-constraint>
## tomcat-users.xml中配置的rolename ##
<role-name>zrlog</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
## 访问提示自定义 ##
<realm-name>aminglinux</realm-name>
</login-config>

· 重新启动tomcat:

/usr/local/tomcat/bin/shutdown.sh &&  /usr/local/tomcat/bin/startup.sh

部署discuz

· 下载discuz安装包到/usr/local/src/目录下

wget http://download.comsenz.com/DiscuzX/3.3/Discuz_X3.3_SC_UTF8.zip

· 解压discuz压缩包(yum -y install unzip)

unzip Discuz_X3.3_SC_UTF8.zip

· 创建discuz的网站根目录

mkdir -p /data/wwwroot/discuz.com/

· 把upload目录下文件拷贝到/data/wwwroot/discuz.com/

mv upload/* /data/wwwroot/discuz.com/

· 创建discuz的数据库和数据库用户

mysql -uroot -p
create database discuz;
grant all on discuz.* to 'discuz'@'%' identified by 'discuz';

· 移动至/data/wwwroot/discuz.com/目录下,根据安装提示修改以下目录和文件的权限

chmod 777 config data data/cache data/avatar data/plugindata data/download data/addonmd5 data/template data/threadcache data/attachment data/attachment/album data/attachment/forum data/attachment/group data/log uc_client/data/cache uc_server/data/ uc_server/data/cache uc_server/data/avatar uc_server/data/backup uc_server/data/logs uc_server/data/tmp  uc_server/data/view

· 在游览器输入域名或IP安装,暂时输入mysql主的信息:

数据库服务器:192.168.118.170
 数据库名:discuz
 数据库用户名:discuz
 数据库密码:discuz
 数据表前缀:pre_

·修改服务器上discuz的配置文件,指定到mycat上,用户数据库密码与mycat对应

vim /data/wwwroot/discuz.com/config/config_global.php
修改内容如下:
$_config['db']['1']['dbhost'] = '192.168.118.169:8066';
$_config['db']['1']['dbuser'] = 'discuz';
$_config['db']['1']['dbpw'] = 'discuz';
$_config['db']['1']['dbcharset'] = 'utf8';
$_config['db']['1']['pconnect'] = '0';
$_config['db']['1']['dbname'] = 'TESTDB1';
$_config['db']['1']['tablepre'] = 'pre_';
$_config['db']['slave'] = '';
$_config['db']['common']['slave_except_table'] = '';

· 重启nginx

discuz的后台二次认证

· 使用命令htpasswd创建用户和密码(先安装yum -y install httpd):

htpasswd -c /usr/local/nginx/conf/htpasswd discuz

· 再次访问后台时需要输入用户认证信息(nginx配置在前面已经完成)

部署dedecms

· 移动到目录/usr/local/src,下载dedecms压缩包:

wget http://updatenew.dedecms.com/base-v57/package/DedeCMS-V5.7-UTF8-SP2.tar.gz

· 解压dedecms

tar zxvf DedeCMS-V5.7-UTF8-SP2.tar.gz

· 进入解压后的DedeCMS目录

cd DedeCMS-V5.7-UTF8-SP2

· 创建dedecms的网站根目录

mkdir -p /data/wwwroot/dedecms

· 把解压后的uploads目录下的所有文件拷贝到dedecms指定的跟目录下:

mv ./uploads/* /data/wwwroot/dedecms.com

· 创建dedecms的数据库和数据库用户

mysql -uroot -p
create database dedecms;
grant all on dedecms.* to 'dedecms'@'%' identified by 'dedecms';

· 根据安装提示,修改以下文件的权限

chmod 777 /data/wwwroot/dedecms.com /data/wwwroot/dedecms.com/install /data/wwwroot/dedecms.com/special && chmod -R 777 /data/wwwroot/dedecms.com/plus/  /data/wwwroot/dedecms.com/dede/ /data/wwwroot/dedecms.com//data/ /data/wwwroot/dedecms.com/a/ /data/wwwroot/dedecms.com/uploads/

· 在游览器输入域名或IP安装,例:

数据库主机:192.168.118.169:8066
数据库用户:dedecms
数据库密码:dedecms
数据表前缀:dede_
数据库名称:TESTDB2

· 根据提示继续安装即可。

dedecms的后台二次认证

· 使用命令htpasswd创建用户和密码(第二次创建不需要-c选项):

htpasswd /usr/local/nginx/conf/htpasswd dedecms

· 再次访问后台时需要输入用户认证信息(nginx配置在前面已经完成)

Nginx负载均衡

· 在nginx代理服务器安装nginx,内容如上(以下负载均衡操作不做说明的均在代理服务器上操作)

· 创建zrlog的负载均衡配置文件:

vim /usr/local/nginx/conf/vhost/zrlog.com.conf
内容如下:
upstream zrlog.com     
{
   
    ip_hash;       
    server 192.168.118.174:80; 
    server 192.168.118.175:80;
    server 192.168.118.176:80;
    server 192.168.118.177:80;
    server 192.168.118.178:80;
    server 192.168.118.179:80;
}   
server      
{
     
    listen 80;                                  
    server_name zrlg.yuankeedu.com;   
    location / 
    {
   
        proxy_pass      http://zrlog.com;           
        proxy_set_header Host   $host; 
        proxy_set_header X-Real-IP      $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    }
}

· 创建discuz的负载均衡配置文件:

vim /usr/local/nginx/conf/vhost/discuz.com.conf
内容如下:
upstream discuz.com     
{
   
    ip_hash;       
    server 192.168.118.174:80; 
    server 192.168.118.175:80;
    server 192.168.118.176:80;
    server 192.168.118.177:80;
    server 192.168.118.178:80;
    server 192.168.118.179:80;
}   
server      
{
     
    listen 80;                                  
    server_name discuz.yuankeedu.com;   
    location /
    {
   
        proxy_pass      http://discuz.com;          
        proxy_set_header Host   $host; 
        proxy_set_header X-Real-IP      $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    }
}

· 创建dedecms的负载均衡配置文件:

vim /usr/local/nginx/conf/vhost/dedecms.com.conf
内容如下:
upstream dedecms.com     
{
   
    ip_hash;       
    server 192.168.118.174:80; 
    server 192.168.118.175:80;
    server 192.168.118.176:80;
    server 192.168.118.177:80;
    server 192.168.118.178:80;
    server 192.168.118.179:80;
}   
server      
{
     
    listen 80;                                  
    server_name dedecms.yuankeedu.com;   
    location / 
    {
   
        proxy_pass      http://dedecms.com;           
        proxy_set_header Host   $host; 
        proxy_set_header X-Real-IP      $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    }
}

· 创建zabbix的代理的配置文件:

vim /usr/local/nginx/conf/vhost/zabbix.conf
内容如下:
server
{
   
    listen 80;
    server_name zabbix.yuankeedu.com;
    location /
    {
   
        proxy_pass      http://192.168.118.180;
        proxy_set_header Host   $host;
        proxy_set_header X-Real-IP      $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

· 登陆zabbix服务器,修改配置文件

vim /etc/httpd/conf.d/zabbix
增加一行,内容如下:
ServerName zabbix.yuankeedu.com
DocumentRoot "/usr/share/zabbix"
重启httpd服务:systemctl restart httpd

· 配置完检查语法,并重新加载配置文件

nginx -t && nginx -s reload
点赞
收藏
评论区
推荐文章
blmius blmius
3年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
皕杰报表之UUID
​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为
待兔 待兔
5个月前
手写Java HashMap源码
HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22
Jacquelyn38 Jacquelyn38
3年前
2020年前端实用代码段,为你的工作保驾护航
有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )
Wesley13 Wesley13
3年前
mysql设置时区
mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0
Wesley13 Wesley13
3年前
00:Java简单了解
浅谈Java之概述Java是SUN(StanfordUniversityNetwork),斯坦福大学网络公司)1995年推出的一门高级编程语言。Java是一种面向Internet的编程语言。随着Java技术在web方面的不断成熟,已经成为Web应用程序的首选开发语言。Java是简单易学,完全面向对象,安全可靠,与平台无关的编程语言。
Stella981 Stella981
3年前
Django中Admin中的一些参数配置
设置在列表中显示的字段,id为django模型默认的主键list_display('id','name','sex','profession','email','qq','phone','status','create_time')设置在列表可编辑字段list_editable
Stella981 Stella981
3年前
Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法
Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法参考文章:(1)Google地球出现“无法连接到登录服务器(错误代码:c00a0194)”解决方法(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fwww.codeprj.com%2Fblo
Wesley13 Wesley13
3年前
MySQL部分从库上面因为大量的临时表tmp_table造成慢查询
背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_
Python进阶者 Python进阶者
11个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这