Нарисовал конфиг из кусков интернет конфигов.
Напонмню, проблема была как с index.php, так и с SSL: по хттп ходтл на сайт, по хттпс - нет.
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.php index.htm;
# Make site accessible from http://localhost/
server_name localhost;
return 301 https://$server_name$request_uri;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
}
server {
# We also enable the SPDY protocol
listen 443 ssl spdy;
# Our SSL certificate
ssl on;
ssl_certificate /etc/nginx/ssl/bundle.crt;
ssl_certificate_key /etc/nginx/ssl/main.key;
# You can change the default root directory here
root /usr/share/nginx/html;
index index.php;
# Your domain name
server_name localhost;
# The maximum body size, useful for file uploads
client_max_body_size 10M;
location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
# PHP-FPM configuration
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
# Deny access to the directory data
location ~* /data {
deny all;
return 404;
}
# Deny access to .htaccess
location ~ /\.ht {
deny all;
return 404;
}
}