I have 2 apps in 2 different folders. I want to use the root folder for everything except when there is /SOMENAME as a folder in the url, in such a case i want to point to that folder.
I tried several location / alias blocks but none of them worked (the location was correct but php files were not served only static content)... see my config below.
server {
listen 80;
#disable_symlinks off;
server_name join.mydomain.com; #allow few domains
root /www/main;
#removing the 'index.php'
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php;
}
index index.html index.php;
}
location /SOMENAME/ {
root /www/somename;
}
#######################
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
include fastcgi_params;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}