Link to home
Start Free TrialLog in
Avatar of Dmitri Farafontov
Dmitri FarafontovFlag for Canada

asked on

Converting NGINX to Apache Configuration.

Looking to convert the following into Apache mod_rewrite rules:

charset utf-8;
error_page 405 =200 $uri;

location / {
		root /path/to/static; # replace with your path to static files

		add_header 'Access-Control-Allow-Origin' '*' always;
		add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, HEAD' always;
		add_header 'Access-Control-Allow-Credentials' 'true' always;
		add_header 'Access-Control-Allow-Headers' 'Accept,Accept-Encoding,Authorization,Cache-Control,Content-Type,DNT,If-Modified-Since,Keep-Alive,Origin,User-Agent,X-Mx-ReqToken,X-Requested-With' always;

		include mime.types;
		types {
			text/plain asp;
		}

		location ~ ^(?<pref>/netEnt/[^/]+/)(?:en/en/)(?<postf>.*)$ {
			try_files $uri $pref$postf =404;
		}

		location ~ ^(?<pref>/netEnt/[^/]+/)(?:en|de|fr|es|pl|ru|it|cn)/(?<postf>.*)$ {
			try_files $uri $pref$postf =404;
		}

		rewrite ^/((?:currencies|gameclient_html)/.*)$ /netEntTouch/$1 last;
		rewrite ^/igt/cleopatra_gpe/studios/interactive/games/CleopatraGpe/(.*)$ /igt/cleopatra_gpe/studios/interactive/games/CleopatraGPE/$1 last;
		rewrite ^/igt/coyotemoon/studios/interactive/games/Coyotemoon/(.*)$ /igt/coyotemoon/studios/interactive/games/CoyoteMoon/$1 last;
		rewrite ^/wazdan/(.+_wzdn)/common/(.*)$ /wazdan/common/$2 last;
	}

	        location ~ ^/microgamingHtml/commonStatic/\"(.*)/microgamingHtml/(?<path>.+)\" {
		        rewrite ^ /microgamingHtml/$path;
	}

Open in new window

Avatar of David Favor
David Favor
Flag of United States of America image

This type of work seems simple + without porting + testing each rule, taking advice on a 100% solution... well, likely won't produce good results.

This work is fairly straight forward + just requires a good bit of time to do the port/test cycle on each rule.

Likely best for you to open a Gig + hire someone to do this, so they work this project from start to finish + you have a working config at the end of their work.
Avatar of Dmitri Farafontov

ASKER

Thought gigs have been discontinued?
Maybe so, then reach out to an Apache expert + hire them to do this for you.

Sometimes getting all this to work can leave you... in a dark corner... rocking... muttering... crying...

Maybe not that bad. Close though.
If you don't have anyone handy to do this work, PM me + we can talk about this.
Thanks David. I would do this but I haven't touched Apache2 in a while since we switched to NGINX. Maybe we can just convert the location matches for now. I seem to be able to figure out the headers part.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.