Hello all,
I have a problem with proper configuration of my page.
What I want to achieve is that:
- http://domain.com/ should point to an upstream bucket of fastcgi apps.
- http://domain.com/administrator should be served by a fastcgi server
on the same machine as balancer, so it should point to 127.0.0.1:3000 in
this case
- i think there is a way to simplify the two backend.php entries
- all /js/ entries for domain.com should be served staticly
- static.domain.com should be served staticly
Don't know what am I doing wrong, but the debug says that when i go to
http://domain.com/administrator it uses the location /administrator but
then it's redirected to /index.php and it uses location /, so not as I
intended.
Can You guys help me sort this out?
Configuration is as follows:
upstream apps {
server 10.0.1.50:3000;
}
server {
listen 80;
server_name domain.com;
error_log /var/log/nginx/domain-error.log debug;
location / {
root /disk0/vhosts/domain/public;
try_files $uri $uri /index.php;
fastcgi_pass apps;
#fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location /administrator {
root /disk0/vhosts/domain/public;
try_files $uri $uri index.php;
fastcgi_pass 127.0.0.1:3000;
#fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME
/disk0/vhosts/domain/public/index.php;
fastcgi_param SCRIPT_FILENAME
/disk0/vhosts/domain/public/$fastcgi_script_name;
include fastcgi_params;
}
location /js/lib/xinha/plugins/ExtendedFileManager/backend.php {
fastcgi_pass 127.0.0.1:3000;
fastcgi_index backend.php;
fastcgi_param SCRIPT_FILENAME
/disk0/vhosts/domain/public/js/lib/xinha/plugins/ExtendedFileManager/backend.php;
include fastcgi_params;
access_log /var/log/nginx/backend1.log;
}
location /js/lib/xinha/plugins/ImageManager/backend.php {
fastcgi_pass 127.0.0.1:3000;
fastcgi_index backend.php;
fastcgi_param SCRIPT_FILENAME
/disk0/vhosts/domain/public/js/lib/xinha/plugins/ImageManager/backend.php;
include fastcgi_params;
access_log /var/log/nginx/backend2.log;
}
location ~ ^/(js)/ {
root /disk0/vhosts/domain/public;
expires 30d;
access_log /var/log/nginx/js.log;
}
}
server {
listen 80;
server_name static.domain.com;
location / {
root /disk0/vhosts/domain/static;
access_log off;
expires 30d;
}
}
server {
listen 80;
server_name .domain2.com;
location / {
fastcgi_pass 127.0.0.1:3000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/disk0/vhosts/domain2/public/index.php;
include fastcgi_params;
}
}