diff --git a/Dockerfile b/Dockerfile index 135c749..735d078 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,9 @@ RUN yarn build #Stage 2 FROM nginx:1.19.0 +COPY . /usr/share/nginx/html +COPY nginx.conf /etc/nginx/conf.d/default.conf + WORKDIR /usr/share/nginx/html RUN rm -rf ./* diff --git a/nginx.conf b/nginx.conf index f3ee622..f2ed1d3 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,42 +1,57 @@ -user nginx; -worker_processes 1; +server { + listen 80 default_server; + listen [::]:80 default_server; + + # SSL configuration + # + # listen 443 ssl default_server; + # listen [::]:443 ssl default_server; + # + # Note: You should disable gzip for SSL traffic. + # See: https://bugs.debian.org/773332 + # + # Read up on ssl_ciphers to ensure a secure configuration. + # See: https://bugs.debian.org/765782 + # + # Self signed certs generated by the ssl-cert package + # Don't use them in a production server! + # + # include snippets/snakeoil.conf; + + root /var/www/html; + + # Add index.php to the list if you are using PHP + index index.html index.htm index.nginx-debian.html; + + server_name _; -error_log /var/log/nginx/error.log warn; -pid /var/run/nginx.pid; - -events { - worker_connections 1024; -} - -http { - include /etc/nginx/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"'; - - access_log /var/log/nginx/access.log main; - - sendfile on; - #tcp_nopush on; - - keepalive_timeout 65; - - gzip on; - - server { - listen 80; - server_name localhost; - root /usr/share/nginx/html; - - # To make sure any assets can get through :) location / { - try_files $uri /index.html; + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri /index.html; + # proxy_pass http://localhost:8080; + # proxy_http_version 1.1; + # proxy_set_header Upgrade $http_upgrade; + # proxy_set_header Connection 'upgrade'; + # proxy_set_header Host $host; + # proxy_cache_bypass $http_upgrade; } - location @rewrites { - rewrite ^(.+)$ /index.html last; - } - } -} + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # include snippets/fastcgi-php.conf; + # + # # With php7.0-cgi alone: + # fastcgi_pass 127.0.0.1:9000; + # # With php7.0-fpm: + # fastcgi_pass unix:/run/php/php7.0-fpm.sock; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} \ No newline at end of file