I'm pretty new to nginx.
I have two types of code one is simple php running through, index2.php
and I have one directory named wordpress
inside it has a whole wordpress website.
What I'm trying to achieve is to get them both running on the main domain without slashes with subdirectory names.
location ~ (/lottery-results|patternTwo) {
try_files $uri /index2.php$is_args$args;
}
location / {
try_files $uri /wordpress/index.php?$args;
}
This is the config I am currently using it works fine for my purpose.
The first directive loads some urls through simple php in index2.php
.
The second directive loads wordpress, however when I open this url:
http://domain.test/
It send me to:
http://domain.test/wordpress/wp-admin/setup-config.php
My problem is that /wordpress
part I want the url to be:
http://domain.test/wp-admin/setup-config.php
instead.
I tried to use alias and root but it didn't change anything, (honestly I don't get what alias and root even does!)
edit : PHP-FPM handler:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI_phpMAMP_PhpLocalhost_MAMP.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /Applications/MAMP/conf/nginx/fastcgi_params;
}