Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
nginx [2019/10/01 14:37] – [5. Rewrite the site's config file.] Add something from https://nginxconfig.io/ misaka00251 | nginx [2020/01/18 11:47] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 55: | Line 55: | ||
Here is an example secure conf. | Here is an example secure conf. | ||
- | <code - example.com> | + | <code - nginx.conf> |
- | charset utf-8; | + | # This file default locate at / |
- | sendfile on; | + | user www-data; |
- | tcp_nopush on; | + | pid / |
- | tcp_nodelay on; | + | worker_processes auto; |
+ | worker_rlimit_nofile 65535; | ||
+ | events { | ||
+ | multi_accept on; | ||
+ | worker_connections 65535; | ||
+ | } | ||
+ | |||
+ | http { | ||
+ | charset utf-8; | ||
+ | sendfile on; | ||
+ | tcp_nopush on; | ||
+ | tcp_nodelay on; | ||
+ | server_tokens off; | ||
+ | log_not_found off; | ||
+ | types_hash_max_size 2048; | ||
+ | client_max_body_size 16M; | ||
+ | |||
+ | # MIME | ||
+ | include mime.types; | ||
+ | default_type application/ | ||
+ | |||
+ | # logging | ||
+ | access_log / | ||
+ | error_log / | ||
+ | |||
+ | # SSL | ||
+ | ssl_session_timeout 1d; | ||
+ | ssl_session_cache shared: | ||
+ | ssl_session_tickets off; | ||
+ | |||
+ | # Mozilla Modern configuration | ||
+ | ssl_protocols TLSv1.3; | ||
+ | |||
+ | # OCSP Stapling | ||
+ | ssl_stapling on; | ||
+ | ssl_stapling_verify on; | ||
+ | resolver 1.1.1.1 1.0.0.1 valid=60s; | ||
+ | resolver_timeout 2s; | ||
+ | |||
+ | # load configs | ||
+ | include / | ||
+ | include / | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | <code - example.com> | ||
server { | server { | ||
server_tokens off; | server_tokens off; | ||
Line 118: | Line 163: | ||
ssl_trusted_certificate / | ssl_trusted_certificate / | ||
- | | + | |
+ | root $base; | ||
index index.php index.html; | index index.php index.html; | ||
Line 130: | Line 176: | ||
include snippets/ | include snippets/ | ||
fastcgi_pass unix:/ | fastcgi_pass unix:/ | ||
- | fastcgi_index index.php; | ||
fastcgi_buffers 8 16k; | fastcgi_buffers 8 16k; | ||
fastcgi_buffer_size 32k; | fastcgi_buffer_size 32k; |