I am trying to install my first LEMP stack and, after a lot of hours and reading, it's working pretty well (Damn, the www-data group write permissions issue was a tough one).
Anyway, my Joomla site is now working and performing better than ever, but I have noticed a strange issue with the pretty urls:
If I access to www.mysite.com/index.php/some/content/alias/
everything is good. However, it's also OK if I access www.mysite.com/index.phpsome/content/alias/
(notice the absence of the slash after index.php
).
Is that the expected behavior? I know end users won't access those anyway, but its mere existence is driving me nuts, because it should throw a 404, right?
This is my config:
server {
listen 80;
server_name domain.bla;
return 301 http://www.domain.bla$request_uri;
}
server {
listen 80;
server_name www.domain.bla;
root /home/domain/public_html;
index index.php index.html index.html;
#Specify a charset
charset utf-8;
# Custom 404 page
error_page 404 /404.html;
# Include the basic h5bp config set
# The error remains if I comment this out, so that's not the problem
include h5bp/basic.conf;
# Enable PHP-FPM
include fastcgi_php.conf;
}
fastcgi_php.conf:
location / {
try_files $uri $uri/ /index.php?q=$request_uri;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
# fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
... and fastcgi_params:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https if_not_empty;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
By the way, cgi.fix_pathinfo
is set to 0.
Any clue? Thanks in advance!