Below is my guide to setup Nginx on IBM i PASE environment and have it work with PHP. Let me know if you have any problems. If you don’t already have PHP installed and compiled from source you can check my guide here: https://godzillaibmi.com/2016/06/21/compiling-php7-from-source-on-ibmi-pase-aix/ .
#some things we may need: | |
wget http://www.oss4aix.org/download/RPMS/zlib/zlib-devel-1.2.8-1.aix5.1.ppc.rpm | |
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv zlib-devel-1.2.8-1.aix5.1.ppc.rpm | |
#nginx: [emerg] using regex "\.php$" requires PCRE library in /usr/local/nginx/conf/nginx.conf:72 | |
wget http://www.oss4aix.org/download/RPMS/pcre/pcre-8.35-1.aix5.1.ppc.rpm | |
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv pcre-8.35-1.aix5.1.ppc.rpm | |
wget http://www.oss4aix.org/download/RPMS/pcre/pcre-devel-8.35-1.aix5.1.ppc.rpm | |
rpm –ignoreos –ignorearch –nodeps –replacepkgs -hUv pcre-devel-8.35-1.aix5.1.ppc.rpm | |
#git source | |
git clone https://github.com/nginx/nginx -c http.sslVerify=false | |
cd nginx | |
#configure it, make it, install it | |
PATH=/opt/freeware/bin:$PATH \ | |
CC=gcc \ | |
CFLAGS=-O3 \ | |
./auto/configure \ | |
–error-log-path=/var/log/nginx/error.log \ | |
–http-log-path=/var/log/nginx/access.log \ | |
–with-http_ssl_module \ | |
–pid-path=/var/run/nginx.pid \ | |
–without-http_scgi_module \ | |
–without-http_uwsgi_module \ | |
–with-cpu-opt=ppc64 && gmake && gmake install | |
joe /usr/local/nginx/conf/nginx.conf | |
/* | |
server { | |
listen 61183; | |
location / { | |
root html; | |
index index.php index.html index.htm; | |
} | |
location ~* \.php$ { | |
fastcgi_index index.php; | |
fastcgi_pass 127.0.0.1:9000; | |
include fastcgi_params; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param SCRIPT_NAME $fastcgi_script_name; | |
} | |
*/ | |
#test config | |
/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf | |
#nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok | |
#nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful | |
#run nginx webserver | |
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf | |
#Create a test file | |
rm /usr/local/nginx/html/index.html | |
echo "<?php phpinfo(); ?>" >> /usr/local/nginx/html/index.php | |
#stop the webserver and start it. | |
/usr/local/nginx/sbin/nginx -s stop | |
/usr/local/nginx/sbin/nginx | |
#setup for PHP | |
cp ~/php-src/php.ini-development /usr/local/phpdave7/lib/php.ini | |
ln -s /usr/local/phpdave7/lib/php.ini /usr/local/phpdave7/etc | |
joe /usr/local/phpdave7/lib/php.ini | |
#find cgi.fix_pathinfo and set it to 0 | |
#cgi.fix_pathinfo=0 | |
#References: | |
# http://php.net/manual/en/install.unix.nginx.php | |
# https://sites.google.com/site/rhdisk0/unix/aix/nginx-aix |