113 lines
3.1 KiB
Nginx Configuration File
113 lines
3.1 KiB
Nginx Configuration File
user nginx;
|
|
worker_processes auto;
|
|
|
|
http {
|
|
# BASIC SETTINGS
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
|
|
types_hash_max_size 2048;
|
|
|
|
# Required for attachments
|
|
client_max_body_size 10m;
|
|
|
|
# Enable gzip
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
include mime.types;
|
|
|
|
# Disallow embedding in iFrames
|
|
add_header X-Frame-Options deny;
|
|
|
|
# use custom log format for nginx amplify monitoring
|
|
log_format main_ext '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for" '
|
|
'"$host" sn="$server_name" '
|
|
'rt=$request_time '
|
|
'ua="$upstream_addr" us="$upstream_status" '
|
|
'ut="$upstream_response_time" ul="$upstream_response_length" '
|
|
'cs=$upstream_cache_status' ;
|
|
access_log /var/log/nginx/access.log main_ext;
|
|
error_log /var/log/nginx/error.log warn;
|
|
|
|
# nginx stub status for monitoring
|
|
server {
|
|
listen 127.0.0.1:80;
|
|
server_name 127.0.0.1;
|
|
location /nginx_status {
|
|
stub_status on;
|
|
allow 127.0.0.1;
|
|
deny all;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 80 default_server;
|
|
listen [::]:80 default_server;
|
|
server_name _;
|
|
|
|
# Challenge for certificate renewal
|
|
location /.well-known/acme-challenge/ {
|
|
root /certbot;
|
|
}
|
|
|
|
# Redirect all http traffic to https
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
# We don't need a host name here since we're only
|
|
# dealing with one domain, but you may insert your domain here.
|
|
server_name _;
|
|
|
|
# Both server and pwa are served over https
|
|
listen 443 ssl http2;
|
|
|
|
# Challenge for certificate renewal
|
|
location /.well-known/acme-challenge/ {
|
|
root /certbot;
|
|
}
|
|
|
|
# This will resolve to the server instance
|
|
location /server {
|
|
resolver 127.0.0.11 valid=60s;
|
|
set $server "http://server:3000";
|
|
proxy_pass $server;
|
|
# rewrite ^/server(.*)$ $1 break;
|
|
}
|
|
|
|
# This will resolve to the server instance
|
|
location /provisioning {
|
|
resolver 127.0.0.11 valid=60s;
|
|
set $provisioning "http://server:4000";
|
|
proxy_pass $provisioning;
|
|
# rewrite ^/padloc_server(.*)$ $1 break;
|
|
}
|
|
|
|
# This will resolve to the web app
|
|
location / {
|
|
root /pwa;
|
|
|
|
index index.html;
|
|
|
|
try_files $uri /index.html;
|
|
}
|
|
|
|
# SSL certificate
|
|
ssl_certificate /ssl/cert;
|
|
# SSL private key
|
|
ssl_certificate_key /ssl/key;
|
|
# Advanced SSL configuration
|
|
include /ssl/ssl.conf;
|
|
# Diffie-Hellman parameters
|
|
ssl_dhparam /ssl/dhparams.pem;
|
|
}
|
|
}
|
|
|
|
events {
|
|
}
|