|
| 1 | +worker_processes 1; |
| 2 | +error_log stderr warn; |
| 3 | +pid /run/nginx.pid; |
| 4 | + |
| 5 | +events { |
| 6 | + worker_connections 1024; |
| 7 | +} |
| 8 | + |
| 9 | +http { |
| 10 | + include mime.types; |
| 11 | + default_type application/octet-stream; |
| 12 | + |
| 13 | + # Define custom log format to include reponse times |
| 14 | + log_format main_timed '$remote_addr - $remote_user [$time_local] "$request" ' |
| 15 | + '$status $body_bytes_sent "$http_referer" ' |
| 16 | + '"$http_user_agent" "$http_x_forwarded_for" ' |
| 17 | + '$request_time $upstream_response_time $pipe $upstream_cache_status'; |
| 18 | + |
| 19 | + access_log /dev/stdout main_timed; |
| 20 | + error_log /dev/stderr notice; |
| 21 | + |
| 22 | + keepalive_timeout 65; |
| 23 | + |
| 24 | + server_tokens off; |
| 25 | + |
| 26 | + # set client body size to 8M # |
| 27 | + client_max_body_size 8M; |
| 28 | + |
| 29 | + # Write temporary files to /tmp so they can be created as a non-privileged user |
| 30 | + client_body_temp_path /tmp/client_temp; |
| 31 | + proxy_temp_path /tmp/proxy_temp_path; |
| 32 | + fastcgi_temp_path /tmp/fastcgi_temp; |
| 33 | + uwsgi_temp_path /tmp/uwsgi_temp; |
| 34 | + scgi_temp_path /tmp/scgi_temp; |
| 35 | + |
| 36 | + # Default server definition |
| 37 | + server { |
| 38 | + listen [::]:8080 default_server; |
| 39 | + listen 8080 default_server; |
| 40 | + server_name _; |
| 41 | + |
| 42 | + sendfile off; |
| 43 | + |
| 44 | + root /var/www/badaso/public; |
| 45 | + index index.php index.html; |
| 46 | + |
| 47 | + location / { |
| 48 | + # First attempt to serve request as file, then |
| 49 | + # as directory, then fall back to index.php |
| 50 | + try_files $uri $uri/ /index.php?$query_string; |
| 51 | + } |
| 52 | + |
| 53 | + # Redirect server error pages to the static page /50x.html |
| 54 | + error_page 500 502 503 504 /50x.html; |
| 55 | + location = /50x.html { |
| 56 | + root /var/lib/nginx/html; |
| 57 | + } |
| 58 | + |
| 59 | + # Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000 |
| 60 | + location ~ \.php$ { |
| 61 | + try_files $uri =404; |
| 62 | + fastcgi_split_path_info ^(.+\.php)(/.+)$; |
| 63 | + fastcgi_pass unix:/run/php-fpm.sock; |
| 64 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 65 | + fastcgi_param SCRIPT_NAME $fastcgi_script_name; |
| 66 | + fastcgi_index index.php; |
| 67 | + include fastcgi_params; |
| 68 | + } |
| 69 | + |
| 70 | + location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { |
| 71 | + expires 5d; |
| 72 | + } |
| 73 | + |
| 74 | + # Deny access to . files, for security |
| 75 | + location ~ /\. { |
| 76 | + log_not_found off; |
| 77 | + deny all; |
| 78 | + } |
| 79 | + |
| 80 | + # Allow fpm ping and status from localhost |
| 81 | + location ~ ^/(fpm-status|fpm-ping)$ { |
| 82 | + access_log off; |
| 83 | + allow 127.0.0.1; |
| 84 | + deny all; |
| 85 | + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
| 86 | + include fastcgi_params; |
| 87 | + fastcgi_pass unix:/run/php-fpm.sock; |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + gzip on; |
| 92 | + gzip_proxied any; |
| 93 | + gzip_types text/plain application/xml text/css text/js text/xml application/x-javascript text/javascript application/json application/xml+rss; |
| 94 | + gzip_vary on; |
| 95 | + gzip_disable "msie6"; |
| 96 | + |
| 97 | + # Include other server configs |
| 98 | + include /etc/nginx/conf.d/*.conf; |
| 99 | +} |
0 commit comments