Dockerfile 代码
From hub.c.163.com/public/nginx:1.2.1
RUN rm -v /etc/nginx/nginx.conf
ADD nginx.conf /etc/nginx/
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN chown -R www-data:www-data /var/lib/nginx
RUN mkdir -p /usr/src/node-app
RUN mkdir -p /usr/src/node-app/dist
WORKDIR /usr/src/node-app
COPY dist/. /usr/src/node-app/dist/
EXPOSE 22 80 443
ENTRYPOINT /etc/init.d/nginx start && /usr/sbin/sshd -D
nginx.conf 代码
worker_processes 1;
events { worker_connections 1024; }
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 60000;
client_body_timeout 60000;
client_header_timeout 60000;
send_timeout 60000;
reset_timedout_connection on;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_max_size 4096;
server_names_hash_bucket_size 128;
server_name_in_redirect off;
client_header_buffer_size 128k;
large_client_header_buffers 4 256k;
client_max_body_size 10240m;
server {
listen 80;
root /usr/src/node-app/dist;
location ^~ /api/ {
proxy_pass http://10.1.31.35:5200/;
}
location / {
try_files $uri @fallback;
}
location @fallback {
rewrite .* /index.html break;
}
}
}