I have this configuration of nginx :
server {
listen 80;
server_name example.com www.example.com;
location = / {
root /var/www/example.com;
index index.php;
}
location / {
root /var/www/example.com/Drupal;
index index.php index.html;
if (!-f $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
if (!-d $request_filename) {
rewrite ^(.*)$ /index.php?q=$1 last;
break;
}
}
location ~ \.php$ {
set $php_root /var/www/example.com/Drupal;
if ($request_uri ~ ^/MassMail) {
set $php_root /var/www/example.com/MassMail;
}
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $php_root$fastcgi_script_name;
}
I have 2 app in php :
- the first in /var/www/example.com/MassMail
- the second in /var/www/example.com/Drupal (a Drupal blog)
my server serve right the two URL
example.com/ –> drupal blog
example.com/MassMail –> other app
but it doesn’t serve the image or the JavaScript … (error 404)
for serve img etc i have tested lot of thing like this (for example …) :
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico)$ {
expires 30d;
access_log off;
}
maybe missing a root directory for, but which?
You php thinks that MassMail installed in the / (root), try to add second location for staitc files:
Configuration #2
Configuration #3
Place each app configuration in special file(example for MassMail):
applications/massmail.conf:
nginx.conf: