<html><head><title>Re: apache rewrite to nginx</title>
</head>
<body>
<span style=" font-family:'courier new'; font-size: 12pt;">Hi Frank Dias.<br>
<br>
Frank Dias wrote on 12.06.2017:<br>
<br>
</span><table>
<tr>
<td width=2 bgcolor= #0000ff><br>
</td>
<td><span style=" font-family:'calibri'; font-size: 11pt;">I need some help, migrating from Apache to Nginx.<br>
The following logic is in Apache, how do I convert to Nginx</td>
</tr>
</table>
<br>
<span style=" font-family:'courier new'; font-size: 12pt;">Where do you stuck?<br>
Have you tried this docs to start?<br>
</span><a style=" font-family:'courier new'; font-size: 12pt;" href="http://nginx.org/en/docs/http/converting_rewrite_rules.html"></a><br>
<a style=" font-family:'courier new'; font-size: 12pt;" href="http://nginx.org/en/docs/http/converting_rewrite_rules.html">http://nginx.org/en/docs/http/converting_rewrite_rules.html</a><br>
<a style=" font-family:'courier new'; font-size: 12pt;" href="https://www.nginx.com/blog/creating-nginx-rewrite-rules/">https://www.nginx.com/blog/creating-nginx-rewrite-rules/</a><br>
<br>
<span style=" font-family:'Courier New'; font-size: 12pt; color: #000000;">or some other link from the search?<br>
<br>
</span><a style=" font-family:'courier new'; font-size: 12pt;" href="https://www.startpage.com/do/dsearch?query=nginx+convert+rewrite+rule&cat=web&pl=opensearch〈uage=deutsch">https://www.startpage.com/do/dsearch?query=nginx+convert+rewrite+rule&cat=web&pl=opensearch</a><br>
<br>
<br>
<table>
<tr>
<td width=2 bgcolor= #0000ff><br>
</td>
<td><span style=" font-family:'calibri'; font-size: 11pt;"><VirtualHost 172.20.1.145:443><br>
DocumentRoot "/var/www/default"<br>
ServerName *.diasranch.net<br>
SSLProxyEngine On<br>
ProxyPreserveHost On<br>
RewriteEngine on<br>
RewriteMap host_finder prg:/usr/local/bin/host_finder.php</td>
</tr>
</table>
<br>
<span style=" font-family:'courier new'; font-size: 12pt;">I think you will need one of the embeded languages in nginx (js, perl, lua).<br>
<br>
</span><table>
<tr>
<td width=2 bgcolor= #0000ff><br>
</td>
<td><span style=" font-family:'calibri'; font-size: 11pt;"># Rule to handle the + character in (un)marking a voicemail and Par Cntl<br>
RewriteCond %{HTTP_HOST} ^rwa-(.*) [OR]<br>
RewriteCond %{HTTP_HOST} ^m2m-(.*) [OR]<br>
RewriteCond %{HTTP_HOST} ^dwa-(.*)<br>
RewriteRule ^(/ws/v[1-9]/dias/[^+]*)\+([^+]*)$ </span><a style=" color: #0563c1; font-family:'calibri'; font-size: 11pt;" href="https://$%7bhost_finder:%25%7bHTTP_HOST%7d%7d/$1/%2B$2">https://${host_finder:%{HTTP_HOST}}/$1\%2B$2</a><span style=" font-family:'calibri'; font-size: 11pt;"> [NE,P,L]<br>
RewriteCond %{HTTP_HOST} ^rwa-(.*) [OR]<br>
RewriteCond %{HTTP_HOST} ^m2m-(.*) [OR]<br>
RewriteCond %{HTTP_HOST} ^dwa-(.*)<br>
RewriteRule ^(/ws/v[1-9]/dias/.*)\+(.*)$ $1\%2B$2 [N,NE]<br>
# The next rule catches everything else and does not use the NE flag<br>
RewriteCond %{HTTP_HOST} ^rwa-(.*) [OR]<br>
RewriteCond %{HTTP_HOST} ^m2m-(.*) [OR]<br>
RewriteCond %{HTTP_HOST} ^dwa-(.*)<br>
RewriteRule ^/(.*) </span><a style=" color: #0563c1; font-family:'calibri'; font-size: 11pt;" href="https://$%7bhost_finder:%25%7bHTTP_HOST%7d%7d/$1">https://${host_finder:%{HTTP_HOST}}/$1</a><span style=" font-family:'calibri'; font-size: 11pt;"> [P,L]<br>
# The next rule is to defeat TRACE attecks which is a med security CVE<br>
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)<br>
RewriteRule .* - [F]<br>
ErrorLog logs/ssl_error_log<br>
#TransferLog logs/ssl_access_log<br>
LogLevel warn<br>
SSLEngine on<br>
SSLProxyProtocol all -SSLv2 -SSLv3<br>
SSLProtocol all -SSLv2 -SSLv3<br>
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW<br>
SSLCertificateFile /etc/pki/tls/certs/star.diasranch.net.crt<br>
SSLCertificateKeyFile /etc/pki/tls/private/star.diasranch.net_key.pem<br>
SSLCertificateChainFile /etc/pki/tls/certs/star.diasranch.net.crt<br>
SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt</td>
</tr>
</table>
<br>
<a style=" font-family:'courier new'; font-size: 12pt;" href="http://nginx.org/en/docs/http/ngx_http_ssl_module.html">http://nginx.org/en/docs/http/ngx_http_ssl_module.html</a><br>
<br>
<table>
<tr>
<td width=2 bgcolor= #0000ff><br>
</td>
<td><span style=" font-family:'calibri'; font-size: 11pt;">SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown downgrade-1.0 force-response-1.0<br>
#CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x [%r] %b"<br>
CustomLog /dev/null " " <br>
</VirtualHost><br>
<br>
<span style=" font-family:'courier new'; font-size: 12pt;">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. </td>
</tr>
</table>
<br>
<span style=" font-family:'Courier New'; font-size: 12pt; color: #000000;">I hate such useless disclaimer to mailing lists 8-O<br>
<br>
<span style=" font-family:'arial'; font-size: 9pt; color: #c0c0c0;"><i>-- <br>
Best Regards<br>
Aleks</body></html>