diff options
author | Dmitry Ilvokhin <d@ilvokhin.com> | 2023-12-21 18:08:22 +0000 |
---|---|---|
committer | Dmitry Ilvokhin <d@ilvokhin.com> | 2023-12-21 18:08:22 +0000 |
commit | 98deb6b468c52d09c69c699b02ab16791f557beb (patch) | |
tree | 3dd114dfd79a81f577c0ffa93e8bf3bd06d70759 /roles/web/files/nginx/nginx.conf | |
parent | 1fe154b136bce2fb063e39050d9bc0deb2279bb0 (diff) | |
download | infra-98deb6b468c52d09c69c699b02ab16791f557beb.tar.gz infra-98deb6b468c52d09c69c699b02ab16791f557beb.tar.bz2 infra-98deb6b468c52d09c69c699b02ab16791f557beb.zip |
Enable certbot for certificates renewal
Diffstat (limited to 'roles/web/files/nginx/nginx.conf')
-rw-r--r-- | roles/web/files/nginx/nginx.conf | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/roles/web/files/nginx/nginx.conf b/roles/web/files/nginx/nginx.conf new file mode 100644 index 0000000..ce8302d --- /dev/null +++ b/roles/web/files/nginx/nginx.conf @@ -0,0 +1,55 @@ +# Run workers under http user. +user http; + +# Set number of worker processes to number of available CPU cores. +worker_processes 1; + +# Log errors in a separate file. +error_log /var/log/nginx/error.log; + +# Write a PID-file. +pid /run/nginx.pid; + + +events { + # Maximum number of simultaneous connections that can be opened by a worker + # process. + # worker_connections 512; +} + + +http { + include 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"'; + + # Use log_format defined above. + access_log /var/log/nginx/access.log main; + + # Enable use of sendfile. + sendfile on; + + # Set keepalive timeout to 65 seconds. + keepalive_timeout 65; + + # Set types_hash_max_size to 2048 to avoid warning in logs. + types_hash_max_size 4096; + + # Load configs for all enabled sites. + include /etc/nginx/sites-enabled/*; + + server { + # Listen on port 80 and become a default server. + listen 80; + listen [::]:80 default_server; + + # Serve as a default server block. + server_name _; + + # Redirect any non-matched request to default page. + return 301 https://ilvokhin.com$request_uri; + } +} |