安装zrlog,discuz,dedecms
安装这3个站点需要用到LNMP+JDK+Tomcat架构
搭建LNMP架构
https://blog.51cto.com/13578154/category6.html
搭建 JDK+Tomcat
https://blog.51cto.com/13578154/2116185 #16.2-16.3
zrlog-->jdk+tomcat
https://blog.51cto.com/13578154/2116660 #16.6-16.8
discuz-->nginx
- Nginx虚拟主机 DiscuzX
mkdir /usr/local/nginx/conf/vhost/
vim /usr/local/nginx/conf/vhost/discuz666.com.conf //写入如下内容
server
{
listen 80 ;
server_name www.discuz666.com;
index index.html index.htm index.php;
root /data/web/discuz666.com/upload;
location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls)$
{
expires 7d;
valid_referers none blocked server_names *.discuz666.com ;
if ($invalid_referer) {
return 403;
}
access_log off;
}
location ~\.php$
{
include fastcgi_params;
fastcgi_pass unix:/tmp/discuz666.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/web/discuz666.com/upload$fastcgi_script_name;
}
location ~ admin.php
{
auth_basic "Auth";
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
}
access_log /tmp/discuz666.com.log combined_realip;
}
Nginx防盗链、静态文件不记录日志和过期时间
解析php相关配置,fastcgi_pass 用来指定php-fpm监听的地址或者socket (出现502错误时需要检查)
访问日志
针对URL的admin用户认证
2 将8080端口转换成80端口
firewall-cmd --zone=public --permanent --add-port=8080/tcp --add-port=80/tcp
firewall-cmd --reload && firewall-cmd --list-all
3 下载discuz
mkdir /data/web
cd /data/web/
yum install -y git
git clone https://gitee.com/ComsenzDiscuz/DiscuzX.git
mv DiscuzX/ discuz666.com
4 绑定本机hosts,随后进入安装配置界面
www.discuz666.com
5 权限授权
创建授权脚本
vim discuz666_file_perm.sh
#!/bin/bash
filepath=/data/web/discuz666.com/upload/
if [ ! pwd
= "$filepath" ]; then
cd $filepath
fi
array=(
./config/config_global.php
./config/config_ucenter.php
./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
)
for file in ${array[*]}
do
chmod a+w $file
echo "$file perm is ok"
done
6 数据库配置
mysql -uroot -p输入密码
mysql> create database discuz666;
mysql> grant all on discuz666. to 'discuz666'@'127.0.0.1' identified by '输入密码';
grant all on discuz666. to 'discuz666'@'127.0.0.1' identified by '输入密码';
mysql -udiscuz666 -h127.0.0.1 -p输入密码
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| discuz666 |
| test |
+--------------------+
3 rows in set (0.00 sec)
管理员
用户名 admin
密码 输入密码
7 继续配置 www.discuz666.com
注册测试
linux
输入密码
#上传图片保存路径
/data/web/discuz666.com/upload/data/attachment/image/
dedemsc-->nginx
1 php-fpm 配置
首先添加dedemcs的用户
useradd dedecms
vim /usr/local/php-fpm/etc/php-fpm.d/dedecms666.com.conf //写入如下内容
[dedecms666.com]
listen = /tmp/dedecms666.sock
listen.mode=666
user = dedecms
group = php-fpm
pm = dynamic
pm.max_children = 50
pm.start_servers = 20
pm.min_spare_servers = 5
pm.max_spare_servers = 35
pm.max_requests = 500
rlimit_files = 1024
request_slowlog_timeout = 2
slowlog = /usr/local/php-fpm/var/log/dedecms666-slow.log
php_admin_value[open_basedir]=/data/web/dedecms666.com/uploads:/tmp/
2 nginx的 conf配置
vim /usr/local/nginx/conf/vhost/dedecms666.com.conf //写入如下内容
server
{
listen 80;
server_name www.dedecms666.com;
index index.html index.htm index.php;
root /data/web/dedecms666.com/uploads;
location ~* ^.+\.(gif|jpg|png|swf|flv|rar|zip|doc|pdf|gz|bz2|jpeg|bmp|xls)$
{
expires 7d;
valid_referers none blocked server_names *.dedecms666.com ;
if ($invalid_referer) {
return 403;
}
access_log off;
}
location ~\.php$
{
include fastcgi_params;
fastcgi_pass unix:/tmp/dedecms666.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /data/web/dedecms666.com/uploads$fastcgi_script_name;
}
location ~ admin.php
{
auth_basic "Auth";
auth_basic_user_file /usr/local/nginx/conf/htpasswd;
}
access_log /tmp/dedecms666.com.log combined_realip;
}
Nginx防盗链、静态文件不记录日志和过期时间
解析php相关配置,fastcgi_pass 用来指定php-fpm监听的地址或者socket (出现502错误时需要检查)
访问日志
3 针对URL的用户认证
用户认证密码制作
yum install -y httpd
htpasswd -c /usr/local/nginx/conf/htpasswd dedecms666
设置密码,如:123456
4 下载 dedecms
cd /data/web/
wget http://updatenew.dedecms.com/base-v57/package/DedeCMS-V5.7-UTF8-SP2.tar.gz
tar zxvf DedeCMS-V5.7-UTF8-SP2.tar.gz
mv DedeCMS-V5.7-UTF8-SP2 dedecms666.com
5 权限设置
chmod 755 dedecms666.com
chown -R root:root dedecms666.com
编写dedecms的脚本
vim dedecms666_file_perm.sh
#!/bin/bash
filepath=/data/web/dedecms666.com/uploads/
if [ ! pwd
= "$filepath" ]; then
cd $filepath
fi
array=(
../uploads
./plus/
./dede/
./data/*
./a
./install
./special
./uploads
)
for ((i=0;i<${#array[*]};i++))
do
if [ -d "${array[i]}" ]; then
chmod 777 ${array[i]}
echo "${array[i]} perm is 777"
else
chmod 777 ${array[i]}
echo "${array[i]} perm is 755"
fi
done
6 数据库配置
mysql -uroot -p输入密码
mysql> create database dedecms666;
mysql> grant all on dedecms666.* to 'dedecms666'@'127.0.0.1' identified by 'linux666';
mysql -udedecms2501 -h127.0.0.1 -p输入密码
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| dedecms666 |
| test |
+--------------------+
3 rows in set (0.00 sec)
管理员
用户名 admin
密码 linux666
注册测试
linux
linux666
7 访问登录测试
www.dedecms666.com
8 done
后台管理
http://www.dedecms666.com/dede/login.php