Member Avatar for FakeTales

i am a bit stuck and dont know whats the quickest and easiest solution.

We have one domain name lets say www.example.com , however we have many 3rd part sites that are in the directory /export/sites/htdocs/example/

at the moment all access logs and error logs for the 20+ sites we have are stored in one of these files.

I want to split the logging so for example we have www.example.com/test1 to have its seperate access log and error log in its directory:

/export/sites/htdocs/example/test1/logs

Whats the best way to achieve this

Recommended Answers

All 4 Replies

Member Avatar for FakeTales

I have looked at setting up virtual hosts however i am a bit lost on doing so.

In the examples they reference separate servernames however we have one server with sites being served from sub directories.

EDIT:

maybe i could do this with aliases?

maybe i could do this with aliases?

Hmm, no, because the ErrorLog directive can be set only once for each domain. The easiest solution is to create subdomains for each website and configure indipendent directives.

The CustomLog is used to trace the requests to the server, so it's the access log, you could use an environment variable to trace each website and assign indipendent custom logs, check:

Not tested, but something like this in server or virtual context, should work:

<Directory site1>
    SetEnv subwebsite1
</Directory>

<Directory site2>
    SetEnv subwebsite2
</Directory>

CustomLog ${APACHE_LOG_DIR}/site1.log combined env=subwebsite1
CustomLog ${APACHE_LOG_DIR}/site2.log combined env=subwebsite2
Member Avatar for FakeTales

So if i go down the root of setting up Directories for these websites am i able to set ErrorLog for these?

Or is the outcome i can only have CustomLog

Edit

Ignore what i said above there, i get it now.

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.