**
yum安装jdk
**
1、yum -y list java* 查看可安装java版本 选择安装 java-1.8.0-openjdk-accessibility.x86_64 2、yum install -y java-1.8.0-openjdk-devel.x86_64 耐心等待安装完成即可 3、java -version 即可查看当前安装的java版本 4、yum安装的jdk,被安装到哪里去了? 你可以在**/usr/lib/jvm**目录下 5、ls 或者ll 可以查看安装的java相关内容
**
docker-compose 安装nginx
**
1、下载nginx 镜像
docker pull nginx
下载最新的版本
docker pull nginx:xxx
下载对应的nginx版本
2、创建对应的nginx挂载文件目录
mkdir -p /home/nginx/conf
mkdir -p /home/nginx/log
3、编写docker-compose.yml文件
version: '3.3'
services:
nginx:
image: nginx:1.20
container_name: nginx-warning
environment:
TZ: Asia/Shanghai
restart: always
ports:
- 80:80
volumes:
- /usr/local/docker/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- /home/gotion-qems/gotion-warning-web/:/usr/share/nginx/html
- /usr/local/docker/nginx/log:/var/log/nginx
- /etc/localtime:/etc/localtime:ro
4、编写对应的ngixn.conf
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
#nginx中的proxy_read_timeout指令用于设置代理连接的超时时间。当nginx作为代理服务器转发请求给后端服务器时,如果后端服务器在指定的时间内没有响应,nginx将终止连接并返回错误
proxy_read_timeout 6000s;
# 限制body大小
client_max_body_size 100m;
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;
upstream server {
ip_hash;
server 0.0.0.0:8088; #网关监听端口
}
server {
listen 80;
server_name 0.0.0.0;
location / {
root /usr/share/nginx/html/dist;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /dev-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://server/;
}
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://server/;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
5、进入容器命令查看挂载文件
docker exec -it {容器id}|{容器名称} /bin/bash
docker cp 命令:
1、把容器内的文件或目录复制到主机上:docker cp <容器id|容器名称>:容器内的路径 主机的路径
2、把主机上的文件或目录复制到容器内:docker cp 主机的路径 <容器id|容器名称>:容器内的路径