nginx|Nginx配置AJP

*请使用源码方式安装Nginx!

下载Nginx及必须的包

Step 1:


mkdir -p /usr/src/nginx && cd /usr/src/nginx

apt-get install unzip

wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz

tar zxvf openssl-1.0.1j.tar.gz

wget http://www.zlib.net/zlib-1.2.11.tar.gz

tar zxvf zlib-1.2.11.tar.gz

wget https://nchc.dl.sourceforge.net/project/pcre/pcre/8.42/pcre-8.42.zip
unzip pcre-8.42.zip

wget https://codeload.github.com/yaoweibin/nginx_ajp_module/zip/master -O nginx_ajp_module-master.zip

unzip nginx_ajp_module-master.zip

wget http://nginx.org/download/nginx-1.4.4.tar.gz

tar nginx-1.4.4.tar.gz



Step 2:
配置及编译Nginx

cd nginx-1.4.4

./configure--prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error/error.log --pid-path=/usr/local/nginx/logs/nginx.pid --user=nginx --group=nginx --http-log-path=/usr/local/nginx/logs/httpd.log --http-client-body-temp-path=/usr/local/nginx/temp/http-client-body-temp --http-proxy-temp-path=/usr/local/nginx/temp/http-proxy-temp --without-http_fastcgi_module --http-uwsgi-temp-path=/usr/local/nginx/temp/http-uwsgi-temp --http-scgi-temp-path=/usr/local/nginx/temp/http-scgi-temp --with-pcre=/usr/src/nginx/pcre-8.42 --with-zlib=/usr/src/nginx/zlib-1.2.11/--add-module=/usr/src/nginx/nginx_ajp_module-master/ --with-openssl=/usr/src/nginx/openssl-1.0.1j/ --with-http_ssl_module

make

make install




*如果编译遇到问题报错


-getpwnam(“nginx”) failed

没有安装nginx用户导致的无法启动

useradd -s /sbin/nologin -M nginx
id nginx




报错
nginx: [emerg] mkdir() "/var/temp/nginx/client" failed (2: No such file or direc

sudo mkdir-p /usr/local/nginx/temp/http-client-body-temp




---------------------------------------------------------------------------------


安装Tomcat或其他Web容器


NginxAPJ 简单配置

nginx.con


location /{

ajp_connect_timeout 120s;
ajp_keep_conn on;
ajp_pass 127.0.0.x:8009;
}

    推荐阅读