docker-compose安装nginx
·
准备文件
- 新建nginx目录、nginx/logs目录、nginx/web目录、conf.d目录
- 在nginx/conf.d目录下新建文件default.conf
server { listen 80; server_name localhost; client_max_body_size 10m; proxy_max_temp_file_size 30m; proxy_connect_timeout 300; proxy_read_timeout 300; proxy_send_timeout 300; location / { root /web; index index.html; try_files $uri /index.html; } location /api/ { proxy_pass http:xxxxxx; } }
docker-compose.yml
version: '3'
services:
nginx:
image: nginx
container_name: nginx
restart: always
ports:
- 80:80
volumes:
- ./web:/web
- ./logs:/var/log/nginx
- ./conf.d:/etc/nginx/conf.d
- 启动容器
docker-compose up -d
更多推荐


所有评论(0)