I'm trying to set up my nginx-server to accomplish the following
x.com opens index.php in /
x.com/example opens example.php in /
x.com/example/ opens example.php in /
x.com/foo/example opens example.php in /foo/
I have the following configuration
server {
listen www.delibr.com:443 default_server; # if this is not a default server, remove "default_server"
root /var/delibr.se;
index index.php index.html index.htm; # this is also irrelevant
server_name www.delibr.com;
ssl_certificate /path to/crt;
ssl_certificate_key /path to/key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers AES256+EECDH:AES256+EDH:!aNULL;
location /beta {
return 302 /#signup-form;
}
location / {
try_files $uri $uri.php $uri/;
if ($host != 'www.delibr.com') {
rewrite ^ https://www.delibr.com$request_uri? permanent;
}
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
With this setup /example downloads example.php and /example/ gives 500 Internal Server error. Can anyone help me?