File tree 5 files changed +151
-0
lines changed
5 files changed +151
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Generated by nginxconfig.io
2
+ # https://nginxconfig.io/?0.domain=example.com&0.non_www=false&0.cert_type=custom&0.ssl_certificate=%2Fetc%2Fnginx%2Fssl%2Fnginx.crt&0.ssl_certificate_key=%2Fetc%2Fnginx%2Fssl%2Fnginx.key
3
+
4
+ user www-data;
5
+ pid /run/nginx.pid;
6
+ worker_processes auto;
7
+ worker_rlimit_nofile 65535 ;
8
+
9
+ events {
10
+ multi_accept on ;
11
+ worker_connections 65535 ;
12
+ }
13
+
14
+ http {
15
+ charset utf-8;
16
+ sendfile on ;
17
+ tcp_nopush on ;
18
+ tcp_nodelay on ;
19
+ server_tokens off ;
20
+ log_not_found off ;
21
+ types_hash_max_size 2048 ;
22
+ client_max_body_size 16M ;
23
+
24
+ # MIME
25
+ include mime.types;
26
+ default_type application/octet-stream;
27
+
28
+ # logging
29
+ access_log /var/log/nginx/access.log;
30
+ error_log /var/log/nginx/error.log warn ;
31
+
32
+ # SSL
33
+ ssl_session_timeout 1d ;
34
+ ssl_session_cache shared:SSL:50m;
35
+ ssl_session_tickets off;
36
+
37
+ # modern configuration
38
+ ssl_protocols TLSv1.2;
39
+ ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256;
40
+ ssl_prefer_server_ciphers on ;
41
+
42
+ # OCSP Stapling
43
+ ssl_stapling on;
44
+ ssl_stapling_verify on;
45
+ resolver 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
46
+ resolver_timeout 2s ;
47
+
48
+ # load configs
49
+ include /etc/nginx/conf.d/*.conf;
50
+ include /etc/nginx/sites-enabled/*;
51
+ }
Original file line number Diff line number Diff line change
1
+ # security headers
2
+ add_header X-Frame-Options "SAMEORIGIN" always;
3
+ add_header X-XSS-Protection "1; mode=block" always;
4
+ add_header X-Content-Type-Options "nosniff" always;
5
+ add_header Referrer-Policy "no-referrer-when-downgrade" always;
6
+ add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
7
+ add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
8
+
9
+ # . files
10
+ location ~ /\.(?!well-known) {
11
+ deny all;
12
+ }
13
+
14
+ # assets, media
15
+ location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
16
+ expires 7d;
17
+ access_log off;
18
+ }
19
+
20
+ # svg, fonts
21
+ location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
22
+ add_header Access-Control-Allow-Origin "*";
23
+ expires 7d;
24
+ access_log off;
25
+ }
26
+
27
+ # gzip
28
+ gzip on;
29
+ gzip_vary on;
30
+ gzip_proxied any;
31
+ gzip_comp_level 6;
32
+ gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
Original file line number Diff line number Diff line change
1
+ # 404
2
+ try_files $fastcgi_script_name =404;
3
+
4
+ # default fastcgi_params
5
+ include fastcgi_params;
6
+
7
+ # fastcgi settings
8
+ fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
9
+ fastcgi_index index.php;
10
+ fastcgi_buffers 8 16k;
11
+ fastcgi_buffer_size 32k;
12
+
13
+ # fastcgi params
14
+ fastcgi_param DOCUMENT_ROOT $realpath_root;
15
+ fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
16
+ fastcgi_param PHP_ADMIN_VALUE "open_basedir=$base/:/usr/lib/php/:/tmp/";
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen 443 ssl http2;
3
+ listen [::]:443 ssl http2;
4
+
5
+ server_name www.example.com;
6
+ set $base /var/www/example.com;
7
+ root $base/public;
8
+
9
+ # SSL
10
+ ssl_certificate /etc/nginx/ssl/nginx.crt;
11
+ ssl_certificate_key /etc/nginx/ssl/nginx.key;
12
+
13
+ # index.php
14
+ index index.php;
15
+
16
+ # index.php fallback
17
+ location / {
18
+ try_files $uri $uri/ /index.php?$query_string;
19
+ }
20
+
21
+ # handle .php
22
+ location ~ \.php$ {
23
+ include nginxconfig.io/php_fastcgi.conf;
24
+ }
25
+
26
+ include nginxconfig.io/general.conf;
27
+ }
28
+
29
+ # non-www, subdomains redirect
30
+ server {
31
+ listen 443 ssl http2;
32
+ listen [::]:443 ssl http2;
33
+
34
+ server_name .example.com;
35
+
36
+ # SSL
37
+ ssl_certificate /etc/nginx/ssl/nginx.crt;
38
+ ssl_certificate_key /etc/nginx/ssl/nginx.key;
39
+
40
+ return 301 https://www.example.com$request_uri;
41
+ }
42
+
43
+ # HTTP redirect
44
+ server {
45
+ listen 80;
46
+ listen [::]:80;
47
+
48
+ server_name .example.com;
49
+
50
+ return 301 https://www.example.com$request_uri;
51
+ }
Original file line number Diff line number Diff line change
1
+ ../sites-available/example.com.conf
You can’t perform that action at this time.
0 commit comments