# Config reverse proxy nginx vers apache2

**URL:** <https://www.ruby-forum.com/t/config-reverse-proxy-nginx-vers-apache2/243761>\
**Category:** NGINX\
**Created:** [January 1, 2016, 5:27pm UTC](https://www.ruby-forum.com/t/config-reverse-proxy-nginx-vers-apache2/243761 "2016-01-01T17:27:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [January 1, 2016, 5:27pm UTC](https://www.ruby-forum.com/t/config-reverse-proxy-nginx-vers-apache2/243761/1 "2016-01-01T17:27:41Z")

</div>

Bonjour tous,

Et bonne anne.  
J’ai un serveur web Ubuntu/Apache2 + SSL avec 3 Vhosts  
([site1.domain.org](http://site1.domain.org) [site2.domain.org](http://site2.domain.org) [site3.domain.org](http://site3.domain.org))… Je voudrais  
monter en amont, sur la mme machine un reverse proxy avec nginx.  
Mon firewall/routeur fait du NAT : toutes les requtes en 443 se  
dirigent vers le port 443 du serveur apache.  
Je fais pour l’instant quelques essais sans succs.

- Je ne touche pas au serveur apache.

- Avec nginx j’ai fait la config suivante:

server {  
listen 443;  
server\_name [site1.domain.org](http://site1.domain.org) [site2.domain.org](http://site2.domain.org) [site3.domain.org](http://site3.domain.org);

```
location / {
    proxy_pass http://localhost:81;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

```

}

L’ennui c’est que nginx coute en 443 ainsi que le serveur apache (??)  
Merci pour votre aide 🙂

–  
Cordialement,  
Thierry e-mail : removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![Thierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@Thierry](https://www.ruby-forum.com/u/Thierry)\
**Post date:** [January 1, 2016, 11:52pm UTC](https://www.ruby-forum.com/t/config-reverse-proxy-nginx-vers-apache2/243761/2 "2016-01-01T23:52:03Z")

</div>

petite modif:

Config nginx:

server {  
listen 445;  
server\_name [site1.domain.org](http://site1.domain.org) [site2.domain.org](http://site2.domain.org) [site3.domain.org](http://site3.domain.org);

```
 access_log /var/log/nginx/access-proxy.log;

 location / {
            proxy_pass https://192.168.1.81/;
            include /etc/nginx/proxy.conf;
    }

```

}

Config apache2:

Installation module praf  
Et aprs le de chaque vhost:

 RPAFenable On RPAFsethostname On RPAFproxy\_ips 127.0.0.1 ::1

Au niveau du NAT, je redirige les requtes 443 vers 445 (donc le serveur  
nginx)  
J’ai du log concerne le serveur nginx (essai avec mon telephone):  
[02/Jan/2016:00:40:14 +0200]  
“\x16\x03\x01\x00\xD0\x01\x00\x00\xCC\x03\x03Ew\xF1Q(\x8F\xA5\xB3!\x0B\x84\xE6\xE1\xCD\x9A\x0E\x12\x1C8\xC6\xEE\x8D’;z\xC3\x9C(\x22F\x18\xCE\x00\x00\x22\xCC\x14\xCC\x13\xCC\x15\xC0+\xC0/\x00\x9E\xC0”  
400 166 “-” “-”

Il semblerait que cela soit une erreur SSL.

Merci

> Bonjour tous,

> Et bonne anne.  
> J’ai un serveur web Ubuntu/Apache2 + SSL avec 3 Vhosts  
> ([site1.domain.org](http://site1.domain.org) [site2.domain.org](http://site2.domain.org) [site3.domain.org](http://site3.domain.org))… Je voudrais  
> monter en amont, sur la mme machine un reverse proxy avec nginx.  
> Mon firewall/routeur fait du NAT : toutes les requtes en 443 se  
> dirigent vers le port 443 du serveur apache.  
> Je fais pour l’instant quelques essais sans succs.

> - Je ne touche pas au serveur apache.

> - Avec nginx j’ai fait la config suivante:

> server {  
> listen 443;  
> server\_name [site1.domain.org](http://site1.domain.org) [site2.domain.org](http://site2.domain.org) [site3.domain.org](http://site3.domain.org);

> ```
> location / {
> proxy_pass http://localhost:81;
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header X-Forwarded-Proto $scheme;
> }
> 
> ```
> 
> }

> L’ennui c’est que nginx coute en 443 ainsi que le serveur apache (??)  
> Merci pour votre aide 🙂

---

<div class="post-metadata">

**Author:** ![Thierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@Thierry](https://www.ruby-forum.com/u/Thierry)\
**Post date:** [January 2, 2016, 1:48am UTC](https://www.ruby-forum.com/t/config-reverse-proxy-nginx-vers-apache2/243761/3 "2016-01-02T01:48:18Z")

</div>

* * *

nginx mailing list  
removed\_email\_address@domain.invalid  
[http://mailman.nginx.org/mailman/listinfo/nginx](http://mailman.nginx.org/mailman/listinfo/nginx)

---

<div class="post-metadata">

**Author:** ![Thierry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/65b543/32.png) [@Thierry](https://www.ruby-forum.com/u/Thierry)\
**Post date:** [January 2, 2016, 8:52am UTC](https://www.ruby-forum.com/t/config-reverse-proxy-nginx-vers-apache2/243761/4 "2016-01-02T08:52:23Z")

</div>

Hi there,

Sorry for my french …  
So no luck, still not working even if I add ssl after the port number.  
This time, I do not have any logs to show you …

All my vhost on my apache server are all listening on port 443.  
My nginx server is listening on port 445.

From my routeur, all connexion for https are forwarded to port 445.

Thx for your help.

> > Il semblerait que cela soit une erreur SSL.
> > 
> > Merci
> 
> _French aside :_  
> Bonjour Thierry, ceci est une liste de diffusion internationale, nous  
> nous devons donc de parler exclusivement en anglais.  
> Merci d’avance.

> Le problme vient du fait que tu as oubli d’ajouter le paramtre ssl  
> aprs ton numro de port. Ce qui nous donne :  
> listen 445 ssl;

> \_Back to English :  
> \_You forget to activate ssl option after your port. The right  
> configuration would be like this:  
> listen 445 ssl;
