nginx on AIX
Compiling and running the nginx web server on AIX 6.1/7.1
Source
Compiling with GCC
Using default prefix, GCC 4.7
Variables should be set or replaced by actual values :) Note that everything can be changed later.
CC=gcc CFLAGS=-O3 \
./configure \
--error-log-path=${logdir}/error.log \
--http-log-path=${logdir}/access.log \
--with-http_ssl_module \
--pid-path=${pidfile} \
--without-http_scgi_module \
--without-http_uwsgi_module \
--with-cpu-opt=ppc64
Configuration summary
+ using system PCRE library
+ using system OpenSSL library
+ md5: using OpenSSL library
+ sha1: using OpenSSL library
+ using system zlib library
nginx path prefix: "/usr/local/nginx"
nginx binary file: "/usr/local/nginx/sbin/nginx"
nginx configuration prefix: "/usr/local/nginx/conf"
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
nginx pid file: "${pidfile}"
nginx error log file: "${logdir}/error.log"
nginx http access log file: "${logdir}/access.log"
nginx http client request body temporary files: "client_body_temp"
nginx http proxy temporary files: "proxy_temp"
nginx http fastcgi temporary files: "fastcgi_temp"
Preparation
Variables
Don't forget to replace them in your commands and config files with the selected values :D
confdir=
datadir=
datagrp=
logdir=
loguser=
pidfile=
Filesystem for www content
...or follow your preferred convention
mklv -y wwwlv -t jfs2 rootvg 2
crfs -d wwwlv -m ${datadir} -Ay -v jfs2
mount ${datadir}
chfs -a size=1G ${datadir}
Create application directory structure
...not just for web content
- bin - init scripts, etc
- conf - configuration files
- data - served content
Data might be a separate filesystem, but config and scripts are not supposed to grow (so they may be in the same FS)
Create group and user
using nginx.nginx here
mkgroup nginx # add preferred GID with id=
mkuser pgrp=ngnix home=/var/empty rlogin=false login=false su=false nginx # add preferred UID with id=
Group which can modify content and adjust datadir
mkgroup ${datagrp}
chgrpmem -m + <user for managing content> ${datagrp}
chown -R root.wwwdata ${datadir}
chmod 0770 ${datadir}
Logs
mkdir ${logdir}
chown nginx.nginx ${logdir}
chmod 0750 ${logdir}
chgrpmem -m + ${loguser} nginx
Copy necessary files from the source default, /usr/local/nginx to the application FS - we are going to modify and run them there
cp /usr/local/nginx/conf/nginx.conf ${confdir}
cp /usr/local/nginx/conf/fastcgi.conf ${confdir}
cp /usr/local/nginx/conf/mime.types ${confdir}
Modify config as necessary
vi ${confdir}/nginx.conf
The following lines are pointing to parameters to be changed:
user nginx;
pid ${pidfile};
access_log ${logdir}/access.log;
error_log ${logdir}/error.log;
root ${datadir};
location = /404.html { root ${datadir}/errorpages/;
error_page 500 502 503 504 /50x.html;
location = /50x.html { root ${datadir}/errorpages/;
Running the Web server
Testing the configuration syntax
/usr/local/nginx/sbin/nginx -t -c ${confdir}/nginx.conf
Note that include directives are relative to the config file's path.
Remove default configuration and log directory
rm /usr/local/nginx/conf/fastcgi.conf /usr/local/nginx/conf/fastcgi_params /usr/local/nginx/conf/mime.types /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/scgi_params /usr/local/nginx/conf/uwsgi_params
rm -rf /usr/local/nginx/logs
Managing the server
/usr/local/nginx/sbin/nginx -s [ stop | quit | reopen | reload ]
Version
/usr/local/nginx/sbin/nginx -v
nginx version: nginx/1.3.7
RC script
TODO :)