upstream php-handler { <% if node['zabbix']['php']['use_fpm'] %> server 127.0.0.1:9001; <% else %> server unix:/var/run/php5-fpm.sock; <% end %> } #server { # server_name zabbix.example.com; # return 301 https://zabbix.example.com$request_uri; #} server { listen 80; server_name zabbix.example.com; access_log /var/log/nginx/zabbix.log; error_log /var/log/nginx/zabbix.error; #ssl on; #ssl_certificate /etc/ssl/certs/zabbix.crt; #ssl_certificate_key /etc/ssl/private/zabbix.key; root /var/www/zabbix/; index index.php index.html; client_max_body_size 5m; client_body_buffer_size 128k; location ~ \.php$ { location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; if (!-f $document_root$fastcgi_script_name) { return 404; } #fastcgi_pass unix:/var/run/zabbix.socket; fastcgi_pass php-handler; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; } location ~* \.(jpg|jpeg|png|gif|css|js|ico)$ { expires max; log_not_found off; } location ~ /\.ht { deny all; } location ~ /\. { deny all; } }