Title: Re: apache rewrite to nginx
Hi Frank Dias.

Frank Dias wrote on 12.06.2017:


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

Where do you stuck?
Have you tried this docs to start?

http://nginx.org/en/docs/http/converting_rewrite_rules.html
https://www.nginx.com/blog/creating-nginx-rewrite-rules/

or some other link from the search?

https://www.startpage.com/do/dsearch?query=nginx+convert+rewrite+rule&cat=web&pl=opensearch



<VirtualHost 172.20.1.145:443>
DocumentRoot "/var/www/default"
ServerName *.diasranch.net
SSLProxyEngine On
ProxyPreserveHost On
RewriteEngine on
RewriteMap host_finder prg:/usr/local/bin/host_finder.php

I think you will need one of the embeded languages in nginx (js, perl, lua).


# 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 [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 [P,L]
# The next rule is to defeat TRACE attecks which is a med security CVE
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
ErrorLog logs/ssl_error_log
#TransferLog logs/ssl_access_log
LogLevel warn
SSLEngine on
SSLProxyProtocol all -SSLv2 -SSLv3
SSLProtocol all -SSLv2 -SSLv3
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW
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

http://nginx.org/en/docs/http/ngx_http_ssl_module.html


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 " "
</VirtualHost>

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.

I hate such useless disclaimer to mailing lists 8-O

--
Best Regards
Aleks
_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to