Skip to content

Instantly share code, notes, and snippets.

@fahmifan
Last active November 26, 2019 03:34
Show Gist options
  • Save fahmifan/14b4b086a244faa93f18a6be4f01fba5 to your computer and use it in GitHub Desktop.
Save fahmifan/14b4b086a244faa93f18a6be4f01fba5 to your computer and use it in GitHub Desktop.
Deploy React using Docker + NGINX
FROM nginx:alpine
COPY ./build /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/host.access.log main;
gzip on;
gzip_vary on;
gzip_static on;
gzip_proxied any;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/javascript application/xml;
gzip_disable "MSIE [1-6]\.";
server_tokens off;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri /index.html;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment