dockerfile nginx配置
Posted shenggen
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dockerfile nginx配置相关的知识,希望对你有一定的参考价值。
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; } } }
以上是关于dockerfile nginx配置的主要内容,如果未能解决你的问题,请参考以下文章
10.Docker-----安装初步使用镜像Dockerfile常用指令通过Dockerfile文件封装nginx镜像并优化