store | blogs | forums | twitter | facebook | wiki | downloads | support portal
Atomic Secure Linux
It is currently Fri Oct 24, 2014 11:23 am

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Nginx and Apache integration on Plesk
Unread postPosted: Tue Jan 26, 2010 9:47 am 
Offline
Forum User
Forum User

Joined: Sun Dec 19, 2004 2:41 am
Posts: 20
Location: South Africa
Goal: To integrate Nginx seamlessly on a server running Plesk 8.3 or later

What have been done?
Nginx has been configured and installed and has been setup in a way that minimises the changes to the Plesk setup.

The changes were limited to the following:

1. Updating the
Code:
httpd.conf
file to listen on only certain IP addresses.

2. Adding the
Code:
rpaf.conf
file to
Code:
/etc/http/conf.d
to enable mod_rpaf.

3. Adding a line to the
Code:
vhost.conf
file of the affected site.

Nginx was then configured to serve all requests for the site and to proxy any dynamic (PHP) requests to Apache.

Nginx now logs all the requests to the site's default log directory, created and maintained by Plesk.

What needs to be done?
For the integration to be seamless, I need Plesk to process the Nginx log files instead of the Apache log files.

Apache creates:
Code:
/statistics/logs/access_log
/statistics/logs/error_log


Nginx creates:
Code:
/statistics/logs/nginx_access_log
/statistics/logs/nginx_error_log


Plesk processes all the log files by running the statistics (/usr/local/psa/admin/sbin/statistics) script once a day.

The one possible solution that I could come up with is for me to write a wrapper script, that would execute and:

1. Move
Code:
nginx_access_log
to
Code:
access_log
(ie. replace it)

2. Merge
Code:
error_log
with
Code:
nginx_error_log
, using
Code:
logresolvemerge.pl


3. Reload Nginx and Apache to force them to open new log files.

4. Apache would then start logging to the old
Code:
nginx_access_log
(now
Code:
access_log
) and the merged
Code:
error_log


5. The final step would be to call statistics.

The statistics script would then run like normal, like it always was, processing the following files:
Code:
access_log
error_log


The above process, should allow Plesk to continue reporting on the all the normal traffic accounting.

Where do you fit in?
I was hoping that you may have a bit more in-depth knowledge of the statistics script's inner workings.

Perhaps if I named the files in a certain way, statistics would pickup all the log files and process them?

Any input in this regard, to try and make the integration just that little bit more elegant, would be great.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group