
AI-摘要
GIT GPT
AI初始化中...
介绍自己
生成本文简介
推荐相关文章
前往主页
前往tianli博客
拉取nginx镜像
docker pull nginx
编写好nginx.conf文件
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/json;
sendfile on;
keepalive_timeout 65;
server {
listen 8787;
# 指定前端项目所在的位置
location / {
root /usr/share/nginx/html/client;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://8.134.66.169:7070;
}
}
server {
listen 8788;
# 指定前端项目所在的位置
location / {
root /usr/share/nginx/html/admin;
try_files $uri $uri/ /index.html;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location /api {
rewrite /api/(.*) /$1 break;
proxy_pass http://8.134.66.169:7070;
}
}
}
打包好前端HTML文件
将html和nginx.conf放到nginx文件夹
将nginx文件夹放到服务器上
运行nginx镜像容器
docker run -d \
--name nginx \
-p 8787:8787 \
-p 8788:8788 \
-v /usr/local/soft/nginx/html:/usr/share/nginx/html \
-v /usr/local/soft/nginx/nginx.conf:/etc/nginx/nginx.conf \
nginx
查询容器运行状态
docker ps
阅读建议
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果