我的自备文件
文件传输
内网下直接上传很慢 使用scp命令将另一台服务器上的文件传输过来;在已有文件的服务器往没有文件的服务器传输
scp -r 传输的文件夹/文件 root@要传输的地址:放置的地址
scp -r tools root@172.xx.x.xxx:/data/
安装二进制文件、脚本及各中间件
安装二进制文件、脚本
进入docker服务安装文件目录直接运行install_docker.sh
sh install_docker.sh start
安装Docker可视化界面
端口号也可自己设置
docker run -d --name portainerUI --restart always -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
安装完毕之后测试连接,打开此页面即为安装成功
配置用户名密码等信息即可正常使用
可以很方便的进行中间件或jar包的运行日志查看等操作
安装前需要docker load -i xxx.tar进行拉取
安装Redis
推荐新建一个中间件的目录,然后将中间件都装到对应目录下,即在对应目录下运行即可
端口号均可自行设置,配置你的密码即可
docker run -p 6379:6379 --name redis2380 --restart always -v $PWD/data:/data -d redis:5 redis-server --requirepass "密码"
安装Mysql
在mysql文件夹下创建conf文件夹
mkdir conf
使用vi命令创建并编辑my.cnf配置文件
vi my.cnf
# 我这里比较简单可以按需配置配置文件
[mysqld]
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
skip-character-set-client-handshake
skip-name-resolve
max_connections=1024
lower_case_table_names=1
default_authentication_plugin=mysql_native_password #设置默认的密码验证规则
default-time-zone='+8:00'
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION
返回mysql跟目录,修改端口号及密码
docker run -p 3306:3306 --name mysql --restart always \
-v $PWD/data:/var/lib/mysql \
-v $PWD/logs:/var/log/mysql \
-v $PWD/backup:/backup \
-v $PWD/conf/:/etc/mysql/conf.d/ \
-e MYSQL_ROOT_PASSWORD=密码 \
-d mysql:8.2.0 --lower_case_table_names=1
此时Mysql已启动可使用Navicat进行校验
安装Nginx
创建conf目录
mkdir conf
写入nginx.conf文件,按照自己的需求更改即可
#user nobody;
worker_processes 1;
error_log logs/error.log;
error_log logs/error.log notice;
error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
server_tokens off;
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
client_max_body_size 20m;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 8888;
set $origin '*';
server_name 127.0.0.1;
#charset koi8-r;
#access_log logs/host.access.log main;
#后端地址
location /snappyservice {
rewrite ^.+snappyservice/?(.*)$ /$1 break;
proxy_set_header 'Access-Control-Allow-Origin' $origin;
#设置X-Real-IP后,在java中就可以通过到用户的真实IP地址了。
proxy_set_header X-Real-IP $remote_addr;
proxy_pass http://172.17.0.171:8090;
#启用支持websocket连接
proxy_read_timeout 86400; #超时时间配置,没有这个配置会很坑,websocket会一直掉线。。。
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
#前端地址
location / {
try_files $uri $uri/ @router;
root /usr/share/nginx/views/dist;
index index.html index.htm;
}
location @router {
rewrite ^.*$ /index.html last;
}
#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;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}