# How to allow apache to control SSL traffic?

**URL:** <https://www.ruby-forum.com/t/how-to-allow-apache-to-control-ssl-traffic/240564>\
**Category:** NGINX\
**Created:** [April 21, 2014, 8:01am UTC](https://www.ruby-forum.com/t/how-to-allow-apache-to-control-ssl-traffic/240564 "2014-04-21T08:01:36Z")\
**Posts on this page:** 5\
**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:** [April 21, 2014, 8:01am UTC](https://www.ruby-forum.com/t/how-to-allow-apache-to-control-ssl-traffic/240564/1 "2014-04-21T08:01:36Z")

</div>

Hello list,

My apache vhosts are configured to take care of SSL connections. I have  
installed nginix as http accelerator. How can I instruct nginx to pass  
all  
SSL request to apache SSL vhost ?

Thanks

---

<div class="post-metadata">

**Author:** ![Joydeep\_Bakshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@Joydeep\_Bakshi](https://www.ruby-forum.com/u/Joydeep_Bakshi)\
**Post date:** [April 21, 2014, 10:18am UTC](https://www.ruby-forum.com/t/how-to-allow-apache-to-control-ssl-traffic/240564/2 "2014-04-21T10:18:26Z")

</div>

Hello,

I like to mention the following error from nginx log

\*453 SSL\_do\_handshake() failed (SSL: error:140770FC:SSL  
routines:SSL23\_GET\_SERVER\_HELLO:unknown protocol) while SSL handshaking  
to  
upstream

though the ssl is working fine with apache along (after proper  
modification  
in apache vhost ) when nginx is down.

Any clue please ?

Thanks

On Mon, Apr 21, 2014 at 11:31 AM, Joydeep Bakshi \<

---

<div class="post-metadata">

**Author:** ![Joydeep\_Bakshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@Joydeep\_Bakshi](https://www.ruby-forum.com/u/Joydeep_Bakshi)\
**Post date:** [April 21, 2014, 10:49am UTC](https://www.ruby-forum.com/t/how-to-allow-apache-to-control-ssl-traffic/240564/3 "2014-04-21T10:49:08Z")

</div>

On 21 Apr 2014 07:01, “Joydeep Bakshi” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hello list,
> 
> My apache vhosts are configured to take care of SSL connections. I have  
> installed nginix as http accelerator. How can I instruct nginx to pass  
> all  
> SSL request to apache SSL vhost ?

Most simply, try stopping nginx listening on port 443 and make apache  
listen on 443.

If you want more advanced suggestions than that, you’ll probably have to  
explain what you’re trying to do in more detail.

J

---

<div class="post-metadata">

**Author:** ![Joydeep\_Bakshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@Joydeep\_Bakshi](https://www.ruby-forum.com/u/Joydeep_Bakshi)\
**Post date:** [April 21, 2014, 11:36am UTC](https://www.ruby-forum.com/t/how-to-allow-apache-to-control-ssl-traffic/240564/4 "2014-04-21T11:36:55Z")

</div>

Hello Jonathan,

thanks for your response. Here is the details what I have done so far.

SSL configuration for nginx is as below

server {

listen 443 ssl;  
server\_name [example.com](http://example.com) [http://example2.com](http://example2.com);  
gzip on; # Turn on gZip  
gzip\_disable msie6;  
gzip\_static on;  
gzip\_comp\_level 9;  
gzip\_proxied any;  
gzip\_types text/plain text/css application/x-javascript text/xml  
application/xml application/xml+rss text/javascript;

ssl\_certificate /etc/apache2/myca/server.crt;  
ssl\_certificate\_key /etc/apache2/myca/ssl.key;

ssl\_protocols SSLv2 SSLv3 TLSv1;  
ssl\_ciphers HIGH:!aNULL:!MD5;  
ssl\_prefer\_server\_ciphers on;

location / {  
proxy\_redirect off; # Do not redirect this proxy - It needs to be  
pass-through  
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-Server-Address $server\_addr;  
proxy\_pass\_header Set-Cookie;  
proxy\_pass [https://127.0.0.1:4443](https://127.0.0.1:4443);

}  
}

accordingly apache has

Listen 4443  
VirtualHostexample.com:4443

# General setup for the virtual host

DocumentRoot /srv/www/htdocs/xxx

SSLEngine on  
#Here, I am allowing only “high” and “medium” security key lengths.  
SSLCipherSuite HIGH:MEDIUM  
#Here I am allowing SSLv3 and TLSv1, I am NOT allowing the old SSLv2.  
SSLProtocol all -SSLv2  
#Server Certificate:  
SSLCertificateFile /etc/apache2/myca/server.crt  
#Server Private Key:  
SSLCertificateKeyFile /etc/apache2/myca/ssl.key

# Server Certificate Chain

SSLCertificateChainFile /etc/apache2/myca/ssl.crt

SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

DirectoryIndex index.php

\<Directory “/srv/www/htdocs/xxxi/”\>  
Options Indexes FollowSymLinks MultiViews  
AllowOverride ALL  
Options None  
Order allow,deny  
Allow from all

but when try to access SSL , nginx error.log shows

\*453 SSL\_do\_handshake() failed (SSL: error:140770FC:SSL  
routines:SSL23\_GET\_SERVER\_HELLO:unknown protocol) while SSL handshaking  
to  
upstream

Hope the info help

Thanks

On Mon, Apr 21, 2014 at 2:18 PM, Jonathan M.

---

<div class="post-metadata">

**Author:** ![Joydeep\_Bakshi](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d9b06d/32.png) [@Joydeep\_Bakshi](https://www.ruby-forum.com/u/Joydeep_Bakshi)\
**Post date:** [April 21, 2014, 11:31am UTC](https://www.ruby-forum.com/t/how-to-allow-apache-to-control-ssl-traffic/240564/5 "2014-04-21T11:31:01Z")

</div>

Hello Jonathan,

thanks for your response. Here is the details what I have done so far.

SSL configuration for nginx is as below

server {

listen 443 ssl;  
server\_name [example.com](http://example.com) [http://example2.com](http://example2.com);  
gzip on; # Turn on gZip  
gzip\_disable msie6;  
gzip\_static on;  
gzip\_comp\_level 9;  
gzip\_proxied any;  
gzip\_types text/plain text/css application/x-javascript text/xml  
application/xml application/xml+rss text/javascript;

ssl\_certificate /etc/apache2/myca/server.crt;  
ssl\_certificate\_key /etc/apache2/myca/ssl.key;

ssl\_protocols SSLv2 SSLv3 TLSv1;  
ssl\_ciphers HIGH:!aNULL:!MD5;  
ssl\_prefer\_server\_ciphers on;

location / {  
proxy\_redirect off; # Do not redirect this proxy - It needs to be  
pass-through  
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-Server-Address $server\_addr;  
proxy\_pass\_header Set-Cookie;  
proxy\_pass [https://127.0.0.1:4443](https://127.0.0.1:4443);

}  
}

accordingly apache has

Listen 4443

# General setup for the virtual host

DocumentRoot /srv/www/htdocs/xxx

SSLEngine on  
#Here, I am allowing only “high” and “medium” security key lengths.  
SSLCipherSuite HIGH:MEDIUM  
#Here I am allowing SSLv3 and TLSv1, I am NOT allowing the old SSLv2.  
SSLProtocol all -SSLv2  
#Server Certificate:  
SSLCertificateFile /etc/apache2/myca/server.crt  
#Server Private Key:  
SSLCertificateKeyFile /etc/apache2/myca/ssl.key

# Server Certificate Chain

SSLCertificateChainFile /etc/apache2/myca/ssl.crt

SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW

DirectoryIndex index.php

\<Directory “/srv/www/htdocs/xxxi/”\>  
Options Indexes FollowSymLinks MultiViews  
AllowOverride ALL  
Options None  
Order allow,deny  
Allow from all

but when try to access SSL , nginx error.log shows

\*453 SSL\_do\_handshake() failed (SSL: error:140770FC:SSL  
routines:SSL23\_GET\_SERVER\_HELLO:unknown protocol) while SSL handshaking  
to  
upstream

Hope the info help

Thanks

On Mon, Apr 21, 2014 at 2:18 PM, Jonathan M.
