# Nginx and Apach2

**URL:** <https://www.ruby-forum.com/t/nginx-and-apach2/242426>\
**Category:** NGINX\
**Created:** [June 23, 2015, 5:00pm UTC](https://www.ruby-forum.com/t/nginx-and-apach2/242426 "2015-06-23T17:00:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [June 23, 2015, 5:00pm UTC](https://www.ruby-forum.com/t/nginx-and-apach2/242426/1 "2015-06-23T17:00:14Z")

</div>

I have nginx and apache2 in the same Ubuntu Server 14.04 and i want to  
use  
nginx as proxy server. My idea is when people write [www.mysite.com](http://www.mysite.com),  
nginx  
redirect to apache and i can do that, but the problem is that apache is  
in  
port 81 and when nginx redirect, the url show [www.mysite.com:81/mysite](http://www.mysite.com:81/mysite).  
I  
just want people to see [www.mysite.com](http://www.mysite.com), without :81/mysite.

Tanks,  
Sérgio Marques

Posted at Nginx Forum:

> **[Nginx and Apach2](https://forum.nginx.org/read.php?2,259809,259809#msg-259809)**
>
> I have nginx and apache2 in the same Ubuntu Server 14.04 and i want to use nginx as proxy server. My idea is when people write www.mysite.com, nginx redirect to apache and i can do that, but the problem is that apache is in port 81 and when nginx...

---

<div class="post-metadata">

**Author:** ![sergiofm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/c89c15/32.png) [@sergiofm](https://www.ruby-forum.com/u/sergiofm)\
**Post date:** [June 23, 2015, 5:25pm UTC](https://www.ruby-forum.com/t/nginx-and-apach2/242426/2 "2015-06-23T17:25:56Z")

</div>

Take a look on \*port\_in\_redirect  
[http://nginx.org/en/docs/http/ngx\_http\_core\_module.html#port\_in\_redirect](http://nginx.org/en/docs/http/ngx_http_core_module.html#port_in_redirect)  
\*and  
_proxy\_pass  
 [http://nginx.org/en/docs/http/ngx\_http\_proxy\_module.html#proxy\_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass)_  
configuration.

You probably have to do a proxy\_pass to Apache and ensure that the port  
number is removed from Apache response qhen there is a redirect.
