Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nginx rewrite #4

Closed
jrahmy opened this issue Mar 22, 2013 · 8 comments
Closed

nginx rewrite #4

jrahmy opened this issue Mar 22, 2013 · 8 comments
Assignees
Labels

Comments

@jrahmy
Copy link
Contributor

jrahmy commented Mar 22, 2013

Any idea on an nginx rewrite rule?

@ghost ghost assigned meenie Mar 22, 2013
@meenie
Copy link
Owner

meenie commented Mar 22, 2013

Maybe try this? I've never used nginx, I've only just Googled a couple of articles and kind of guessed how it should work haha. Let me know how it goes! That way I can add it into the documentation 👍

location / {
    rewrite ^(.*\.(?:css|less|scss|js|coffee|jpg|png|gif|jpeg))$ munee.php?files=/$1 last;
}

@jrahmy
Copy link
Contributor Author

jrahmy commented Mar 22, 2013

Tried that earlier via some converter tool, was redirecting fine but then it wouldn't pass the PHP file to fpm for parsing so it would just get downloaded.. thanks though!

@meenie
Copy link
Owner

meenie commented Mar 22, 2013

Well crap! Hopefully this can be figured out so I can put the instructions in the documentation. I'd rather not exclude nginx uses if at all possible. If you do come across a solution, please let me know.

As for a work around for now, try following the "Using Munee without a .htaccess rule" instruction and let me know if that works.

@jrahmy
Copy link
Contributor Author

jrahmy commented Mar 22, 2013

Yeah that's how I've been using it since posting this and it's been working like a charm :) Will try to play around a bit more with rewrites tomorrow, I'll post a solution if I find one.

Also thanks for munee, I liked the idea of Assetic but its use was a bit complicated for my needs.. this has all the features I need and nothing more, and it's easy to use!

@meenie
Copy link
Owner

meenie commented Mar 22, 2013

I appreciate you tinkering with it and trying to find a solution.

Your feedback has made my day 👍 This is the exact reason why I built Munee in the first place :). My designers needed something they can drop in place without much fuss and it just works.

I'll close this question for now. If you find anything new, just open up a new one I suppose :).

@meenie meenie closed this as completed Mar 22, 2013
@jrahmy
Copy link
Contributor Author

jrahmy commented May 1, 2013

Finally had the time to figure out regex.. this works 😃
rewrite ^(.+.(css|less|scss|js|coffee|gif|jpe?g|png))$ /munee.php?files=/$1 break;

@meenie
Copy link
Owner

meenie commented May 1, 2013

Awesome! Thanks for that :-). I'll put it into the Readme ASAP.

@Kinamo
Copy link

Kinamo commented Oct 6, 2016

Hi,

Thanks for the excellent library :-)
We are also using NGinx and had to change the regex a bit, probably depends on the configuration, but here's the block we are using, both with rewrite for index.php as well as rewrite for asset files to Munee. Hope this helps someone:

index   index.php;

location ~ ^(.+\.(css|less|scss|js|coffee|gif|jpe?g|png))$ {
        rewrite ^(.+)$ /munee.php?files=$1 last;
}

location / {
        try_files $uri $uri/ @rewrite;
}

location @rewrite {
       rewrite ^/.*$ /index.php last;
}

 location ~ \.php$ {
       include fastcgi_params;
       ... and so on...
}

Take care!

Kinamo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants