Friday, 9 August 2013

Symfony2 app in subdirectory of nginx configuration

Symfony2 app in subdirectory of nginx configuration

I'm trying to set up my environment such that surveyadmin.local points at
one directory and surveyadmin.local/api points at another.
However, no matter what I change, the /api URL always results in a call to
the directory that surveyadmin.local is pointing at.
Here's my config for the vhost in question:
server {
listen 80;
server_name surveyadmin.local;
location / {
root /srv/http/surveytool/admin/build;
index index.html;
}
location /api {
root /srv/http/surveytool/api/SurveyTool/web;
index app.php;
try_files $uri $uri/ /app.php?$query_String;
location ~ \.php(?|$) {
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index app.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
access_log /var/log/nginx/surveyadmin.access.log;
error_log /var/log/nginx/surveyadmin.error.log debug;
}
What am I doing wrong? How do I force nginx to do what I want?

No comments:

Post a Comment