html->index.html
<!DOCTYPE html>
<!-- saved from url=(0027)http://182.42.113.191:8008/ -->
<html data-darkreader-mode="dynamic" data-darkreader-scheme="dimmed"><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><style class="darkreader darkreader--fallback" media="screen"></style><style class="darkreader darkreader--text" media="screen"></style><style class="darkreader darkreader--invert" media="screen">.jfk-bubble.gtx-bubble, .captcheck_answer_label > input + img, span#closed_text > img[src^="https://www.gstatic.com/images/branding/googlelogo"], span[data-href^="https://www.hcaptcha.com/"] > #icon, #bit-notification-bar-iframe, ::-webkit-calendar-picker-indicator, embed[type="application/pdf"] {
filter: null !important;
}</style><script>//console.log('a')
</script><script>//remove baidu search ad
var _countAA = 0
function doBBBd(){}
doBBBd()
document.addEventListener('keyup', function(){_countAA-=10;doBBBd()}, false)
document.addEventListener('click', function(){_countAA-=10;doBBBd()}, false)
</script></head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body></html>
conf->nginx.conf
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
client_max_body_size 20m;
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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
#开启gzip压缩
gzip on;
#http的协议版本
gzip_http_version 1.0;
#IE版本1-6不支持gzip压缩,关闭
gzip_disable 'MSIE[1-6].';
#需要压缩的文件格式 text/html默认会压缩,不用添加
gzip_types text/css text/javascript application/javascript image/jpeg image/jpg image/png image/gif;
#设置压缩缓冲区大小,此处设置为4个8K内存作为压缩结果流缓存
gzip_buffers 4 8k;
#压缩文件最小大小
gzip_min_length 1k;
#压缩级别1-9
gzip_comp_level 9;
#给响应头加个vary,告知客户端能否缓存
gzip_vary on;
#反向代理时使用
gzip_proxied off;
#upstream myServer {
# server 154.8.232.150:8080; #设置tomcat端口
#}
#upstream myServer2 {
# server 154.8.232.150:7777; #设置corner server端口
#}
include /etc/nginx/conf.d/*.conf;
}
conf->conf.d->default.conf
server {
listen 80;
server_name localhost;
charset utf-8;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
# 测试配置文件
location /baidu {
proxy_pass http://www.baidu.com/; #需要反代的域名
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# 业务服务
# auth
location /auth{
proxy_pass http://172.31.0.44:8009/auth/; #需要反代的域名,电信002:swarm manager节点
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# gateway
location /code {
proxy_pass http://172.31.0.44:8009/code/; #需要反代的域名,电信002:swarm manager节点
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# job
location /schedule {
proxy_pass http://172.31.0.44:8009/schedule/; #需要反代的域名,电信002:swarm manager节点
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# system
location /system {
proxy_pass http://172.31.0.44:8009/system/; #需要反代的域名,电信002:swarm manager节点
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# 静态资源-前端放置在nginx(vue-project-ui)
location ~* ^.+\.(gif|jpg|jpeg|png|ico|pdf|txt|js|css|eot|svg|ttf|woff|mov){
root /usr/share/nginx/html/vue-project-ui;
}
# html
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
#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 /usr/share/nginx/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;
#}
}
以上文件根目录基础文件:docker_install_soft_fast
docker-compose.yaml
version: "3.9"
services:
#指定服务名称mysql、redis
mysql:
image: mysql:5.7.30
#指定容器名称
container_name: mysql
#restart: always
#指定服务运行的端口
ports :
- "3306:3306"
#指定容器的环境变量
environment:
#数据库root密码的密码root
- MYSQL_ROOT_PASSWORD=root
#创建的库
- MYSQL_DATABASE=smart-bar-dev
#允许多IP连接数据库
- MYSQL_ROOT_HOST=%
#挂载数据卷
volumes:
- ./mysql/data:/var/lib/mysql
- ./mysql/conf:/etc/mysql
# - ./mysql/datad:/var/run/mysqld
- ./mysql/datal:/var/log/mysql
redis:
#官方的Redis镜像image
image: redis:6.2.5
#指定容器名称
container_name: redis
#restart: always
# Redis密码root
command: redis-server --requirepass root
ports:
- "6379:6379"
#挂载数据卷
#Redis 的密码需要自己在与容器共享的配置 redis.conf 中加入,即更改配置中 requirepass 为: requirepass yourpassword
volumes:
- ./redis/data:/data
mongodb:
#官方的mongodb镜像image
image: mongo
#指定容器名称
container_name: mongodb
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=root
#restart: always
ports:
- "27017:27017"
#挂载数据卷
volumes:
- ./mongodb/data:/data/db
nginx:
#官方的nginx镜像image
image: nginx:1.20.1
#指定容器名称
container_name: nginx
#restart: always
ports:
- "8008:80"
#挂载数据卷
#nginx
volumes:
- ./html:/usr/share/nginx/html
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./conf/conf.d:/etc/nginx/conf.d
执行:
补充:安装mysql8
建议:运行时修改配置参数!
version: "3.9"
services:
#指定服务名称mysql
mysql:
image: mysql:8.0.31
#指定容器名称
container_name: mysql8031
#restart: always
#指定服务运行的端口
ports :
- "3306:3306"
#指定容器的环境变量
environment:
#数据库root密码的密码root
- MYSQL_ROOT_PASSWORD=root
#创建的库
- MYSQL_DATABASE=test_demo
#允许多IP连接数据库
- MYSQL_ROOT_HOST=%
#挂载数据卷
volumes:
- /opt/docker/mysql/conf/my.cnf:/etc/mysql
- /opt/docker/mysql/data:/var/lib/mysql
- /opt/docker/mysql/logs:/var/log/mysql
command: ['--server-id=1',
'--sync_binlog=1',
'--log-bin=mysql8-bin',
'--binlog-ignore-db=mysql,information_schema,performance_schema,sys',
'--binlog_cache_size=256M',
'--binlog_format=mixed',
'--relay_log=mysql8-relay',
'--lower_case_table_names=1',
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_general_ci',
'--sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION']