I have an existing Expressionengine MSM site that I've moved to nginx on my local machine, consisting of 2 sites in subdirectories:
/en
/system
/index.php
/admin.php
/de
/index.php
/admin.php
/themes
Sites are accessed through https://mydomain.test/en and https://mydomain.test/de
I can view pages using 'index.php' : https://mydomain.test/en/index.php?/pagename
But I can't seem to get the site working without 'index.php?', my nginx.conf is included below (https://www.nginx.com/resources/wiki/start/topics/recipes/expressionengine/)
user username staff;
worker_processes auto;
events {
worker_connections 1024;
}
worker_rlimit_nofile 1024;
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
client_max_body_size 128M;
gzip on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component;
include /Users/username/.valet/Nginx/*;
include servers/*;
include valet/valet.conf;
server {
listen 80;
server_name mydomain;
root /Users/username/nginx/mydomain/;
index index.php;
access_log /usr/local/var/log/nginx/access.log;
error_log /usr/local/var/log/nginx/error.log info;
location /en {
try_files /en/$uri /en/$uri/ /en/index.php?$query_string;
disable_symlinks off;
}
location /de {
try_files /de/$uri /de/$uri/ /de/index.php?$query_string;
disable_symlinks off;
}
location @ee {
rewrite ^(.*) /index.php$1 last;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php-fastcgi.socket;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
}
# This location is for our EE index.php gateway
location /index.php {
include /usr/local/etc/nginx/fastcgi_params;
set $script $uri;
set $path_info $uri;
# this will set the path_info when it exists as query string: /index.php?/something/here
if ($args ~* "^(/.+)$") {
set $path_info $1;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
$document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
}
}
}