0%
nginx配置解析
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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
|
user nginx;
worker_processes auto;
pid /run/nginx.pid;
error_log /var/log/nginx/error.log;
events { worker_connections 1024;
multi_accept on;
accept_mutex on;
accept_mutex_delay 500ms
use epoll;
accept_mutex_delay 500ms;
aio threads; aio_write on; aio_read on;
epoll_events 1024; epoll_event_connections 512; epoll_timeout 1s;
kqueue_events 1024; kqueue_event_connections 512; kqueue_timeout 1s; }
http { include /etc/nginx/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';
access_log /var/log/nginx/access.log main;
error_log /var/log/nginx/error.log main;
sendfile on;
sendfile_max_chunk 100k;
keepalive_timeout 75;
keepalive_requests 100;
gzip on; gzip_types text/plain text/css application/json application/javascript application/xml; gzip_min_length 20; gzip_buffers 4 8k;
error_page error_page 404 /404.html;
upstream backend { server backend1.example.com; server backend2.example.com;
server backend3.example.com weight=3; server backend4.example.com weight=2;
ip_hash;
least_conn;
fair;
hash $remote_addr consistent;
random;
zone backend_zone 64k;
keepalive 16;
keepalive_requests 100;
keepalive_timeout 60s; }
server { listen 80;
server_name example.com;
root /var/www/example.com;
set $limit_rate 4k;
location / {
try_files index.html index.htm @fallback; } location @fallback { root /var/www/error; index index.html; }
location /api {
proxy_pass http: }
location /images/ { alias /var/www/images/;
expires 1d;
add_header Cache-Control "public"; }
location ~ \.php$ { include fastcgi_params; fastcgi_index index.php; fastcgi_pass unix:/var/run/php/php7.x-fpm.sock; fastcgi_pass 127.0.0.1:9000; fastcgi_pass http:
deny 127.0.0.1; allow 172.18.5.54; }
listen 443 ssl;
ssl_certificate /etc/ssl/certs/example.com.crt;
ssl_certificate_key /etc/ssl/private/example.com.key;
listen 443 ssl http2;
add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-XSS-Protection "1; mode=block" always; }
}
|