Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
serving static from nginx while production
- Loading branch information
1 parent
71d56f2
commit 690c725
Showing
3 changed files
with
45 additions
and
49 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
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 |
---|---|---|
@@ -1,63 +1,57 @@ | ||
user nginx; | ||
worker_processes 1; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
user nginx; | ||
worker_processes 1; | ||
|
||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
|
||
events { | ||
worker_connections 1024; | ||
worker_connections 1024; | ||
} | ||
|
||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
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"'; | ||
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; | ||
access_log /var/log/nginx/access.log main; | ||
|
||
sendfile on; | ||
sendfile on; | ||
#tcp_nopush on; | ||
|
||
keepalive_timeout 65; | ||
keepalive_timeout 65; | ||
|
||
gzip on; | ||
gzip on; | ||
gzip_min_length 500; | ||
gzip_proxied expired no-cache no-store private auth; | ||
gzip_types *; | ||
gzip_comp_level 9; | ||
server{ | ||
gzip_proxied expired no-cache no-store private auth; | ||
gzip_types *; | ||
gzip_comp_level 9; | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
index index.html index.htm; | ||
root /usr/share/nginx/html; | ||
location /{ | ||
root /usr/share/nginx/html; | ||
location / { | ||
client_max_body_size 1024M; | ||
client_body_buffer_size 1024K; | ||
proxy_read_timeout 100000; | ||
proxy_set_header Host $host; | ||
proxy_set_header Host $host; | ||
proxy_pass http://cartoview:8000; | ||
} | ||
#location /geoserver/ { | ||
# proxy_pass http://geoserver:8080/geoserver/; | ||
#} | ||
location /geoserver { | ||
|
||
# Using a variable is a trick to let Nginx start even if upstream host is not up yet | ||
# (see https://sandro-keil.de/blog/2017/07/24/let-nginx-start-if-upstream-host-is-unavailable-or-down/) | ||
proxy_pass http://geoserver:8080; | ||
#set $upstream geoserver:8080; | ||
|
||
proxy_set_header Host $http_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_pass http://geoserver:8080; | ||
proxy_set_header Host $http_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; | ||
} | ||
location /static { | ||
alias /cartoview/static/; | ||
} | ||
location /uploaded { | ||
alias /cartoview/uploaded/; | ||
} | ||
} | ||
#include /etc/nginx/conf.d/*.conf; | ||
} |