ensl.org/ext/nginx.conf.d/nginx.conf
2020-04-03 09:51:28 +03:00

119 lines
4.3 KiB
Nginx Configuration File

upstream puma {
# server unix:/srv/ensl/puma.production.sock fail_timeout=0;
server localhost:4000;
}
server {
listen *:80;
listen *:443 ssl;
ssl_certificate /etc/letsencrypt/live/ensl.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ensl.org/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
server_name ensl.org;
root /srv/ensl/root_domain;
return 301 https://www.ensl.org$request_uri;
}
server {
listen *:80;
server_name www.ensl.org;
return 301 https://www.ensl.org$request_uri;
}
server {
listen *:443 ssl default_server;
server_name www.ensl.org;
root /srv/ensl/public;
index index.html index.htm index.php;
ssl_certificate /etc/letsencrypt/live/ensl.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ensl.org/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_stapling on;
ssl_stapling_verify on;
#add_header Strict-Transport-Security max-age=15768000;
access_log /var/log/nginx/ensl.access.log;
error_log /var/log/nginx/ensl.error.log;
rewrite_log on;
client_max_body_size 20M;
keepalive_timeout 10;
location ~ /.well-known {
allow all;
autoindex on;
}
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location /files/ {
try_files $uri $uri/ @puma;
alias /srv/ensl/files/;
autoindex on;
}
location @puma {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://puma;
}
try_files $uri/index.html $uri @puma;
}
upstream puma_staging {
server localhost:5000;
}
server {
listen *:5000 ssl;
server_name www.ensl.org;
root /srv/ensl.org.staging/public;
index index.html index.htm index.php;
auth_basic “ENSL Staging area”;
auth_basic_user_file /etc/nginx/.htpasswd;
ssl_certificate /etc/letsencrypt/live/ensl.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/ensl.org/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:50m;
ssl_stapling on;
ssl_stapling_verify on;
#add_header Strict-Transport-Security max-age=15768000;
#access_log /var/log/nginx/ensl.access.log;
#error_log /var/log/nginx/ensl.error.log;
rewrite_log on;
client_max_body_size 20M;
keepalive_timeout 10;
location ~ /.well-known {
allow all;
autoindex on;
}
location ^~ /assets/ {
gzip_static on;
expires max;
add_header Cache-Control public;
}
location /files/ {
try_files $uri $uri/ @puma_staging;
alias /srv/ensl/files/;
autoindex on;
}
location @puma_staging {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://puma_staging;
}
try_files $uri/index.html $uri @puma_staging;
}