# AJP from apache to nginx

**URL:** <https://www.ruby-forum.com/t/ajp-from-apache-to-nginx/220915>\
**Category:** NGINX\
**Created:** [June 25, 2012, 10:03am UTC](https://www.ruby-forum.com/t/ajp-from-apache-to-nginx/220915 "2012-06-25T10:03:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [June 25, 2012, 10:03am UTC](https://www.ruby-forum.com/t/ajp-from-apache-to-nginx/220915/1 "2012-06-25T10:03:38Z")

</div>

Hi everyone,

first of all i’m completely new user of nginx. I want to move from  
apache-tomcat to nginx-tomcat, but i’m having big problems with nginx  
ajp module and how to use it. Any help would be greatly appreciated!

Here are my apache httpd-vhosts.conf:

NameVirtualHost \*:80  
NameVirtualHost \*:443

\<VirtualHost \*:80\>  
ServerAdmin webmaster@localhost  
ServerName alis.am.lt  
ProxyRequests off  
ProxyPreserveHost on

```
    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    ProxyPass /AlisL09Service

```

[http://10.255.6.120:8080/AlisL09Service/](http://10.255.6.120:8080/AlisL09Service/)  
ProxyPassReverse /AlisL09Service  
[http://10.255.6.120:8080/AlisL09Service/](http://10.255.6.120:8080/AlisL09Service/)

```
    ProxyPass /gis/geoserver/web !
    ProxyPass /gis http://10.255.5.140:8080
    ProxyPassReverse /gis http://10.255.5.140:8080

    ProxyPass / ajp://localhost:8009/
    ProxyPassReverse / ajp://localhost:8009/
    ProxyPassReverse / http://localhost:8009/
    ProxyPassReverseCookiePath /localhost /localhost/

```

 ServerAdmin webmaster@localhost ServerName alis.am.lt

```
    ProxyRequests off
    ProxyPreserveHost on

    <Proxy *>
            Order deny,allow
            Allow from all
    </Proxy>

    ProxyPass /gis/geoserver/web !
    ProxyPass /gis http://10.255.5.140:8080
    ProxyPassReverse /gis http://10.255.5.140:8080

    ProxyPass / ajp://localhost:8009/
    ProxyPassReverse / ajp://localhost:8009/
    ProxyPassReverse / http://localhost:8009/
    ProxyPassReverseCookiePath /localhost /localhost/

    SSLEngine on
    SSLProtocol all
    SSLCertificateFile

```

/home/dts/certificates/alis.publicsite.primary.cert.p7b  
SSLCertificateKeyFile  
/home/dts/certificates/alis.am.lt\_privateKeyNoPass.key  
SSLCertificateChainFile  
/home/dts/certificates/alis.publicsite.intermediate.cert.p7b

SSLPassPhraseDialog builtin

And here’s what i have so far in my nginx.conf:

user nginx;  
worker\_processes 8;

error\_log logs/error.log;  
pid logs/nginx.pid;

events {  
worker\_connections 8192;  
}

http {  
upstream www\_serveriai {  
server 10.255.7.120:443;  
}  
upstream www\_serveriai\_80 {  
server 10.255.7.120:80;  
}  
include /usr/local/nginx/conf/mime.types;  
default\_type application/octet-stream;

```
log_format main '$remote_addr - $remote_user [$time_local]

```

“$request” ’  
'$status $body\_bytes\_sent “$http\_referer” ’  
‘“$http\_user\_agent” “$http\_x\_forwarded\_for”’;

```
access_log /usr/local/nginx/logs/access.log main;

sendfile on;
keepalive_timeout 65;

```

server {  
listen 80;  
server\_name alis.am.lt;  
location / {  
#proxy\_pass ajp://localhost:8009/;  
proxy\_pass [http://localhost:8009/](http://localhost:8009/);  
ajp\_keep\_conn on;  
ajp\_pass www\_serveriai\_80;  
}

}  
}

Posted at Nginx Forum:

> **[AJP from apache to nginx](https://forum.nginx.org/read.php?2,227843,227843#msg-227843)**
>
> Hi everyone, first of all i'm completely new user of nginx. I want to move from apache-tomcat to nginx-tomcat, but i'm having big problems with nginx ajp module and how to use it. Any help would be greatly appreciated! Here are my apache...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 25, 2012, 11:20am UTC](https://www.ruby-forum.com/t/ajp-from-apache-to-nginx/220915/2 "2012-06-25T11:20:48Z")

</div>

why you use two proxy modules? You should choose one. The port 8009  
normally is the AJP connector, you should use it with ajp module. Or  
you can use the port 80 with http proxy module.

Thanks.

2012/6/25 karolis [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [June 25, 2012, 2:50pm UTC](https://www.ruby-forum.com/t/ajp-from-apache-to-nginx/220915/3 "2012-06-25T14:50:01Z")

</div>

Ok, but that doesn’t solve my problem.

Posted at Nginx Forum:

> **[Re: AJP from apache to nginx](https://forum.nginx.org/read.php?2,227843,227856#msg-227856)**
>
> Hi everyone, first of all i'm completely new user of nginx. I want to move from apache-tomcat to nginx-tomcat, but i'm having big problems with nginx ajp module and how to use it. Any help would be greatly appreciated! Here are my apache...
