server { listen 80; server_name ec2-....compute-1.amazonaws.com www.ec2-....compute-1.amazonaws.com; access_log /var/log/nginx/localhost.access.log; ## Disable viewing .htaccess & .htpassword location ~ /\.ht { deny all; } location / { root /var/www/mysite; index index.php index.html; } location ~ \.php$ { root /var/www/mysite; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_pass unix:/dev/shm/php-fpm-www.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/mysite$fastcgi_script_name; include fastcgi_params; fastcgi_ignore_client_abort on; fastcgi_param SERVER_NAME $http_host; } ## Images and static content is treated different location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|xml)$ { access_log off; expires 30d; root /var/www/mysite; } }