Multiple sites under same domain with one app codebase

Francis Daly francis at
Fri Jul 18 14:51:40 UTC 2014

On Fri, Jul 18, 2014 at 09:40:43AM -0400, martyparish wrote:

Hi there,

> I have many separate "sites" to run and they all use the same back end
> application(opencart). They also will be under the same domain, in folders.
> I don't want to duplicate the application code in each subdirectory.

It is not clear to me exactly what you have, and what you have working,
and what you have not working.

Could you give some specific examples?


If I request /site1/img/file.png, what file on the filesystem should
nginx send me; or what file on the filesystem should nginx invite a
fastcgi server to process?

/usr/local/nginx/html/site1/img/file.png; or
/usr/local/nginx/html/img/file.png, or something else?

If I request /site2/dir/file.php -- same question?

And in each case: if that file does not exist, what should happen? 404
or other failure, or fall back to a specific other file?

Francis Daly        francis at

More information about the nginx mailing list