This repository has been archived by the owner on Jun 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rework deployment, serve static assets with nginx
- Loading branch information
Showing
6 changed files
with
236 additions
and
326 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
map $sent_http_content_type $expires { | ||
"text/html" epoch; | ||
"text/html; charset=utf-8" epoch; | ||
default off; | ||
} | ||
|
||
server { | ||
listen 8000 default_server; | ||
|
||
gzip on; | ||
gzip_types text/plain application/xml text/css application/javascript; | ||
gzip_min_length 1000; | ||
|
||
location /_nuxt/ { | ||
alias /usr/src/app/.nuxt/dist/client/; | ||
gzip_static on; | ||
expires max; | ||
add_header Cache-Control public; | ||
} | ||
|
||
location / { | ||
expires $expires; | ||
|
||
proxy_redirect off; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
proxy_read_timeout 1m; | ||
proxy_connect_timeout 1m; | ||
proxy_pass http://127.0.0.1:3000; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
user www-data; | ||
worker_processes 8; | ||
pid /run/nginx.pid; | ||
|
||
events { | ||
worker_connections 768; | ||
multi_accept on; | ||
} | ||
|
||
http { | ||
|
||
## | ||
# Basic Settings | ||
## | ||
|
||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
types_hash_max_size 2048; | ||
|
||
server_names_hash_bucket_size 64; | ||
server_name_in_redirect on; | ||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
log_format custom '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_host" "$proxy_add_x_forwarded_for"'; | ||
|
||
access_log /var/log/nginx/access.log custom; | ||
error_log /var/log/nginx/error.log; | ||
access_log /dev/stdout custom; | ||
error_log /dev/stdout info; | ||
|
||
|
||
gzip on; | ||
gzip_disable msie6; | ||
|
||
gzip_vary on; | ||
gzip_proxied any; | ||
gzip_comp_level 6; | ||
gzip_buffers 16 8k; | ||
gzip_http_version 1.1; | ||
|
||
gzip_types | ||
# text/html is always compressed by HttpGzipModule | ||
text/css | ||
text/javascript | ||
text/xml | ||
text/plain | ||
text/x-component | ||
application/javascript | ||
application/x-javascript | ||
application/json | ||
application/xml | ||
application/rss+xml | ||
application/atom+xml | ||
font/truetype | ||
font/opentype | ||
application/vnd.ms-fontobject | ||
image/svg+xml; | ||
|
||
include /etc/nginx/conf.d/*.conf; | ||
} |
Oops, something went wrong.