DockerFile文件配置
FROM nginx:latest
RUN rm /etc/nginx/conf.d/default.conf
ADD nginx.conf /etc/nginx/nginx.conf
COPY dist/ /usr/share/nginx/html/
nginx.conf
worker_processes 1;
#工作模式与连接数上限
events {
#单个进程最大连接数(最大连接数=连接数*进程数)
worker_connections 1024;
}
http {
#文件扩展名与文件类型映射表
include 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"';
sendfile on;
#长连接超时时间,单位是秒
#keepalive_timeout 0;
keepalive_timeout 65;
server {
listen 80;
# gzip config
gzip on;
gzip_min_length 1k;
gzip_comp_level 9;
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
root /usr/share/nginx/html;
location / {
# 用于配合 browserHistory使用
try_files $uri $uri/ /index.html;
}
}
}
docker build -t
(
P
R
O
J
E
C
T
)
:
(PROJECT):
(PROJECT):(VERSION) .
build的名称全小写
注意大小写
注意大小写
注意大小写
注意大小写