若依管理系统docker部署
若依管理系统docker 部署
源码地址: git clone https://gitee.com/y_project/RuoYi-Vue.git
- 大致的属性结构:
后台部署
- dockerfile文件
前端部署
1.nginx.conf 配置文件
#:user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
2.conf.d/myproject.conf 配置文件
server {
listen 80;
location / {
# vue打包的dist路径
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
# 转发到后端的路径
# 代表访问/dev-api/开头的路径的url时,nginx会转到下面的路径
location /dev-api/ {
# 这里可以是 主机地址+容器外地址
proxy_pass http://主机地址:容器对外端口/;
# 也可以是 容器内的地址:容器的端口
# proxy_pass http://主机地址:容器对外端口/;
}
}
> docker run --name ruo_yi_ngxin -v /home/ruoyi/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
> -v /home/ruoyi/nginx/www:/usr/share/nginx/html
> -v /home/ruoyi/nginx/logs:/var/log/nginx
> -v /home/ruoyi/nginx/conf/conf.d:/etc/nginx/conf.d -p 81:80 nginx