0

I just configured lighttpd web server to pass php-fcgi request to an external application server.

The application server is running PHP 5.3 and spawn-fcgi.

The problem is that all the web files need to exist on both the web server and the application server. If I delete the web files from the application server, I get: "no input file specified". If I delete the web files from the web server, I get a 404 error. When the web files are on both the application and web server, it works.

How in the world is this managed? Is there a way to configure just one set of web files with a symbolic link or something across servers? How is this problem usually addressed? Thanks.

LIGHTTPD CONFIG ON THE WEB SERVER

#### fastcgi module
fastcgi.server             = ( ".php" =>
                           ( "app1.geodb.io" =>
                             (
                               "host" => "192.168.167.82",
                               "port" => 8080,
                               "check-local" => "disable",
                               "disable-time" => 3
                             )
                           )
                         )
Justin
  • 5,008
  • 19
  • 58
  • 82

1 Answers1

1

I'm not sure about the fastcgi issue, but the standard solution for syncing files accross servers is rsync (it uses interesting algorithms to minimize network traffic). Assuming you can designate one of the servers as a "master", that is, define its files as the basis for all other servers, this should be enough:

rsync -avh /var/www/example/ remotehost:/var/www/example/

Do note that ending slashes are significative, and this command will not delete files on the remote host if they are deleted on the master. If you want that append --delete:

rsync -avh --delete /var/www/example/ remotehost:/var/www/example/

You need rsync to be present on both ends, and of course you need ssh access as it uses ssh as its transport (you can use other things, but you're probably better off sticking with ssh if you haven't got a good reason to switch). You also probably want to run this on a cronjob, but if you're deploying files to the "master" using an automated process you could also add it to that job.

EDIT: You could also mount /var/www/example via NFS or some other network file system on all nodes, of course, but then you lose some of each node's independence and risk creating a bottleneck. But if your .php files are very CPU intensive and filesystem I/O doesn't matter that much you could definitely try this option.

Eduardo Ivanec
  • 14,531
  • 1
  • 35
  • 42