Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
                             )
                           )
                         )
share|improve this question
    
Please share the relevant parts of your config so we can see what you mean more clearly. –  Eduardo Ivanec Apr 15 '11 at 19:45
    
Config added. Basically, need to sync the web files between the app and web servers, as the web files need to exists on both. –  Justin Apr 15 '11 at 19:59

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.