R
R
Ruslan2015-03-01 20:40:40
PHP
Ruslan, 2015-03-01 20:40:40

NGINX proxy_pass only PHP on Apache+PHP?

The question is just out of curiosity.
If there is Apache + PHP, a backend with NGINX and you need to return statistics, then explicitly indicate which files.
An example of this

location ~* ^.+\.(ico|bmp|jpg|jpeg|gif|png|svg|eot|ttf|woff|js|css|gz|zip|html|txt|xml)$ {
}

It seems that I have not met any mentions that only PHP should be transferred to Apache. Is there a catch?
Like so
location ~ \.php(?:$|/) {
  proxy_pass https://backend;
}

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vlad Zhivotnev, 2015-03-01
@ThFree

The catch is that php by itself rarely only handles *.php links.
More often, through mod_rewrite in some index.php, all site links are wrapped through mod_rewrite (that is, in htaccess). For example, in my blog php handles links /1, /2 and so on.
And transferring htaccess to the nginx config is not a very easy task for those who write nginx configs according to manuals. There are converters, of course, but they don't always work, and they usually generate garbage.

P
Puma Thailand, 2015-03-01
@opium

you can do as you wrote about php

S
Sergey Petrikov, 2015-03-01
@RicoX

No, no, the most common practice, there are a lot of mentions, although transferring php to php-fpm is more common, but no one forbids transferring to Apache either.

V
Vladimir Shiklgruber, 2015-03-08
@mnjghgmjyt

without effort it is possible without the apache. php fpm and setting htaccess to nginx config

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question