It can be only used with MyPlatform, and can't be used alone.
-
Clone Repository
git clone https://github.com/leeyoshinari/nginx_agent.git
-
Modify
config.conf
. Usually don't need to modify, unless you have special requirements. If the path ofaccess.log
isn't found automatically, the path need to be set inconfig.conf
manually. -
Modify Nginx log format in
nginx.conf
.
Custom log format islog_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $upstream_response_time "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
Use custom log format
access_log logs/access.log main;
If you want to output other information, please add it to end of log format.
-
Package. Using
pyinstaller
to package python code.
- (1) Enter folder, run:
pyinstaller -F server.py -p __init__.py
- (2) Copy
config.conf
to thedist
folder, cmd:cp config.conf dist/
- (3) Enter
dist
folder, zip files, cmd:zip nginx_agent.zip server config.conf
- (4) Upload zip file to MyPlatform
- (5) Deploy nginx_agent
NOTE: For Linux Server, the executable file packaged on the server of the CentOS system X86 architecture can only run on the server of the CentOS system X86 architecture; servers of other system and architecture need to be repackaged.