summaryrefslogtreecommitdiff
path: root/roles/nginx/files/nginx.conf
blob: a4d624c8c677568405bcc38c470d7f26c64adc72 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Run workers under http user.
user http;

# Set number of worker processes to number of available CPU cores.
worker_processes auto;

# 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;

    # Enable TCP_CORK option to send files in full packets.
    tcp_nopush on;

    # Enable TCP_NODELAY option.
    tcp_nodelay on;

    # 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;
    }
}