server {
listen 80;
return 301 https://example.com$request_uri;
}
server {
listen 443 ssl spdy;
listen [::]:443 ssl spdy;
server_name example.com;
#SSL
#Root
root /usr/share/nginx/html;
index index.php index.html index.htm;
#Errors
#PHP
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
include fastcgi_params;
}
}