necore api docker vue nginx

2021-01-25 06:17

阅读:544

标签:htm   doc   use   soft   outer   spn   listen   bash   tco   

1. netcore api 部署 docker 不能指定 端口

 //.UseUrls("http://10.43.21.156:8081")

 

2,vue nginx 前端访问 api nginx的配置

proxy_pass转发的路径后是否带 “/” 的意义都是不一样的(https://www.jianshu.com/p/55c0b967e1a4)

 

3.netcore dockerfile

FROM mcr.microsoft.com/dotnet/core/aspnet:3.0-buster-slim AS base
WORKDIR /app
EXPOSE 80

COPY . .
ENTRYPOINT ["dotnet", "VTMS.Core.dll"]

docker build -t vtmsapi .

docker run --name vtmsapi -d -p 8081:80 vtmsapi

4.vue nginx docker

  dockerfile

FROM nginx
MAINTAINER yyz

COPY dist/  /usr/share/nginx/html/
COPY default.conf /etc/nginx/conf.d/
WORKDIR /usr/share/nginx/html
RUN chmod -R a+rx *
 
  default.conf

server {
listen 80;

#charset koi8-r;
access_log /var/log/nginx/host.access.log;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html; # 这个非常重要,采用vue-router的时候,必须配置这个
}
##配置后端api映射
location ^~ /api/{
proxy_pass http://10.43.21.156:8081;
}

error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

}

docker pull nginx:latest
docker run --name nginx -p 8080:80 -d nginx

docker build -t vtmsadmin .

docker run --name vtmsadmin -d -p 8091:80 vtmsadmin

docker exec -it 7b1fe4f989c4 /bin/bash

curl localhost:8081

 


docker kill $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker rmi -f 强制删除

necore api docker vue nginx

标签:htm   doc   use   soft   outer   spn   listen   bash   tco   

原文地址:https://www.cnblogs.com/yyzyou/p/12028982.html


评论


亲,登录后才可以留言!