server { listen 80; server_name useresponse; root /home/web/useresponse/public; access_log /home/web/useresponse/log/access.log; error_log /home/web/useresponse/log/error.log; location / { index index.php; try_files $uri $uri/ /index.php?$args; } # api requests. rewrite ^/api /api.php; # Directives to send expires headers and turn off 404 error logging. location ~* \.(js|css|png|jpg|jpeg|gif)$ { expires 24h; log_not_found off; add_header Pragma public; add_header Cache-Control "public, must-revalidate, proxy-revalidate"; } ## If no favicon exists return a 204 (no content error). location = /favicon.ico { try_files $uri =204; expires 24h; log_not_found off; access_log off; } ## Don't log robots.txt requests. location = /robots.txt { allow all; log_not_found off; access_log off; } ## this prevents hidden files (beginning with a period) from being served location ~ /\. { access_log off; log_not_found off; deny all; } location ~ \.php$ { client_max_body_size 2M; try_files $uri =404; add_header X-phpcache miss; fastcgi_pass php5-fpm-sock; fastcgi_index index.php; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; } }