参考https://dev.to/frontendfoxes/dockerise-your-nuxt-ssr-app-like-a-boss-a-true-vue-vixens-story-4mm6
docker-compose.yml
version: "3" services: nuxt: build: ./app/ container_name: vuevixens-website restart: always ports: - "3333:3333" command: "npm run start" nginx: image: nginx:1.13 container_name: vuevixens-nginx ports: - "80:80" volumes: - ./nginx:/etc/nginx/conf.d depends_on: - nuxt
default.conf
server { listen 80; server_name localhost; location / { proxy_pass http://vuevixens-website:3333; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
看懂了吗,
proxy_pass 后面是http://{container_name}:expose port