1 基础依赖安装
1.1 服务器要求
建议服务器最低配置 阿里云优惠券
| 类型 | 配置 |
|---|---|
| 操作系统 | CentOS Stream 8 64位 |
| CPU | 4核 |
| 内存 | 16G |
| 带宽 | 5M |
| 硬盘 | 100G |
完整教程地址(本站发不,太多了,电脑卡死): 物联网管理系统安装教程
1.2 程序依赖插件
| 循序 | 名称 | 版本 | 说明 |
|---|---|---|---|
| 1 | Mysql | 8.0 | 最低5.7版本 |
| 2 | Redis | 6.2 | 缓存数据 |
| 3 | Nginx | 1.2.0 | 代理网站 |
| 4 | RabbitMq | 3.9.4 | 消息队列 |
| 5 | JDK | 1.8 | Java程序依赖 |
注意
搭建案例中 Mysql 为 8.0 版本,SQL文件执行也为8.0版本
执行5.7版本会出现语法不兼容问题!!!
推荐安装方式
1.3 安装宝塔
利用宝塔快捷安装
快捷安装 Mysql、Redis、Nginx、Docker
这里讲解一个举例比方说你的linux 服务器 有多个盘 空间大的在
/mnt或/home(如没有其他盘跳至 3步骤)
演示用 /mnt 举例
cd /mnt
[image]
1.创建宝塔面板安装需要用的www目录
mkdir www
[image]
2.建立/mnt/www的软连接到/www (也就是给系统根目录建立一个www的“快捷方式”指向/mnt/www)
cd /
ln -s /mnt/www /www
[image]
3.使用 SSH 连接工具,如堡塔SSH终端连接到您的 Linux 服务器后,挂载磁盘,根据系统执行相应命令开始安装(约2分钟完成):
Centos安装脚本 使用的是推荐的CentOS Stream 类型服务器直接用这个
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
[image]
Ubuntu/Deepin安装脚本
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && sudo bash install.sh
[image]
Debian安装脚本
wget -O install.sh http://download.bt.cn/install/install-ubuntu_6.0.sh && bash install.sh
[image]
Fedora安装脚本
wget -O install.sh http://download.bt.cn/install/install_6.0.sh && bash install.sh
[image]
注意:必须为没装过其它环境如Apache/Nginx/php/MySQL的新系统,推荐使用centos 7.X的系统安装宝塔面板
安装成功之后会打印出 你的服务器访问地址和账户密码 请妥善保管!另存
根据你的服务器宝塔地址访问登录,登录之后需要绑定账号,没有注册的注册一个账号
1.4 宝塔安装插件
1.4.1 安装 Mysql
找到目录 [软件商店] > 应用搜索 Mysql 找到最后右侧 操作 点击 安装 ,安转完之后 打开首页展示 开关
1.4.2 安装 Redis 找到目录 [软件商店] > 应用搜索 Redis 找到最后右侧 操作 点击 安装 ,安转完之后 打开首页展示 开关
1.4.3 安装 Nginx 找到目录 [软件商店] > 应用搜索 Nginx 找到最后右侧 操作 点击 安装 ,安转完之后 打开首页展示 开关
1.4.4 安装 Docker 找到目录 [软件商店] > 应用搜索 Docker 找到最后右侧 操作 点击 安装 ,安转完之后 打开首页展示 开关
如果您需要在服务器外其他服务器下运行 记得开放端口号!
开放端口号
[安全] > 防火墙 放行端口
3306 MySQL服务默认端口
6379 Redis
5672 RabbitMq
[image]
1.5 修改 mysql 配置
找到目录 首页 > 左下角 软件 点击 MySQL 找到 配置修改
复制如下文件 粘贴 点击 保存 找到 服务 再 点击 重启 mysql
PS:注意!该配置文件为Mysql8.0 版本 配置 其他版本直接配置可能会导致无法启动!主要修改内容为:
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
[image]
[client]
#password = your_password
port = 3306
socket = /tmp/mysql.sock
[mysqld]
port = 3306
socket = /tmp/mysql.sock
datadir = /www/server/data
default_storage_engine = InnoDB
performance_schema_max_table_instances = 400
table_definition_cache = 400
skip-external-locking
key_buffer_size = 1024M
max_allowed_packet = 100G
table_open_cache = 4096
sort_buffer_size = 16M
net_buffer_length = 4K
read_buffer_size = 16M
read_rnd_buffer_size = 256K
myisam_sort_buffer_size = 256M
thread_cache_size = 512
tmp_table_size = 512M
default_authentication_plugin = mysql_native_password
lower_case_table_names = 1
sql-mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
explicit_defaults_for_timestamp = true
#skip-name-resolve
max_connections = 500
max_connect_errors = 100
open_files_limit = 65535
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
binlog_expire_logs_seconds = 600000
slow_query_log=1
slow-query-log-file=/www/server/data/mysql-slow.log
long_query_time=3
#log_queries_not_using_indexes=on
early-plugin-load = ""
innodb_data_home_dir = /www/server/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /www/server/data
innodb_buffer_pool_size = 4096M
innodb_log_file_size = 2048M
innodb_log_buffer_size = 512M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_max_dirty_pages_pct = 90
innodb_read_io_threads = 8
innodb_write_io_threads = 8
[mysqldump]
quick
max_allowed_packet = 500M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 1024M
sort_buffer_size = 16M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[image]
1.6 修改 Redis 密码
开源项目默认 Redis 为 Rdis20220107
找到目录 首页 > 左下角 软件 点击 Redis 找到 性能调整 > requirepass
将 requirepass 文本框 粘贴 Rdis20220107 点击 保存
如需 配置外网可访问 Redis
修改配置文件中 bind 127.0.0.1 将其注释 点击 保存 找到 服务 再 点击 重启 Redis
#bind 127.0.0.1
[image]
1.7 配置 Nginx
配置之前需要准备域名 如 到你的服务器
找到目录 首页 > 左下角 软件 点击 Nginx 找到 配置修改
复制如下文件 粘贴 点击 保存 找到 服务 再 点击 重启 Nginx
user www www;
worker_processes auto;
error_log /www/wwwlogs/nginx_error.log crit;
pid /www/server/nginx/logs/nginx.pid;
worker_rlimit_nofile 51200;
events
{
use epoll;
worker_connections 51200;
multi_accept on;
}
http
{
include mime.types;
#include luawaf.conf;
include proxy.conf;
default_type application/octet-stream;
server_names_hash_bucket_size 512;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
fastcgi_intercept_errors on;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
limit_conn_zone $binary_remote_addr zone=perip:10m;
limit_conn_zone $server_name zone=perserver:10m;
server_tokens off;
access_log off;
server
{
listen 888;
server_name phpmyadmin;
index index.html index.htm index.php;
root /www/server/phpmyadmin;
#error_page 404 /404.html;
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /\.
{
deny all;
}
access_log /www/wwwlogs/access.log;
}
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#root html;
#index index.html index.htm;
root admin;
index index.html;
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
server{
listen 80; #监听端口
server_name demo.5iot.cn;
location / {
root admin;
index index.html;
try_files $uri $uri/ /index.html;
}
location /prod-api/ {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:8080/;
}
}
include /www/server/panel/vhost/nginx/*.conf;
}


可以共享、可以push的免费邮箱,更可使用自定义域名,完美契合您的各项需求。
12 条回复
排序