apache rewrite to nginx

Frank Dias frank.dias at prodea.com
Mon Jun 12 20:15:50 UTC 2017

I need some help, migrating from Apache to Nginx.
The following logic is in Apache, how do I convert to Nginx

DocumentRoot "/var/www/default"
ServerName *.diasranch.net
SSLProxyEngine On
ProxyPreserveHost On
RewriteEngine on
RewriteMap host_finder prg:/usr/local/bin/host_finder.php
# Rule to handle the + character in (un)marking a voicemail and Par Cntl
RewriteCond %{HTTP_HOST} ^rwa-(.*) [OR]
RewriteCond %{HTTP_HOST} ^m2m-(.*) [OR]
RewriteCond %{HTTP_HOST} ^dwa-(.*)
RewriteRule ^(/ws/v[1-9]/dias/[^+]*)\+([^+]*)$ https://${host_finder:%{HTTP_HOST}}/$1\%2B$2<https://$%7bhost_finder:%25%7bHTTP_HOST%7d%7d/$1/%2B$2> [NE,P,L]
RewriteCond %{HTTP_HOST} ^rwa-(.*) [OR]
RewriteCond %{HTTP_HOST} ^m2m-(.*) [OR]
RewriteCond %{HTTP_HOST} ^dwa-(.*)
RewriteRule ^(/ws/v[1-9]/dias/.*)\+(.*)$ $1\%2B$2 [N,NE]
# The next rule catches everything else and does not use the NE flag
RewriteCond %{HTTP_HOST} ^rwa-(.*) [OR]
RewriteCond %{HTTP_HOST} ^m2m-(.*) [OR]
RewriteCond %{HTTP_HOST} ^dwa-(.*)
RewriteRule ^/(.*) https://${host_finder:%{HTTP_HOST}}/$1<https://$%7bhost_finder:%25%7bHTTP_HOST%7d%7d/$1> [P,L]
# The next rule is to defeat TRACE attecks which is a med security CVE
RewriteRule .* - [F]
ErrorLog logs/ssl_error_log
#TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProxyProtocol all -SSLv2 -SSLv3
SSLProtocol all -SSLv2 -SSLv3
SSLCertificateFile /etc/pki/tls/certs/star.diasranch.net.crt
SSLCertificateKeyFile /etc/pki/tls/private/star.diasranch.net_key.pem
SSLCertificateChainFile /etc/pki/tls/certs/star.diasranch.net.crt
SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0
#CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x [%r] %b"
CustomLog /dev/null " "

This message is confidential to Prodea unless otherwise indicated or apparent from its nature. This message is directed to the intended recipient only, who may be readily determined by the sender of this message and its contents. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient:(a)any dissemination or copying of this message is strictly prohibited; and(b)immediately notify the sender by return message and destroy any copies of this message in any form(electronic, paper or otherwise) that you have.The delivery of this message and its information is neither intended to be nor constitutes a disclosure or waiver of any trade secrets, intellectual property, attorney work product, or attorney-client communications. The authority of the individual sending this message to legally bind Prodea is neither apparent nor implied,and must be independently verified.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20170612/75ed5cc4/attachment.html>

More information about the nginx mailing list