A
A
Alexander2011-09-26 18:27:43
PHP
Alexander, 2011-09-26 18:27:43

Nginx, php variable?

There is a task: php gives a variable and nginx needs to take this variable and insert it into proxy_pass, how can I implement this? And how should I give php this variable so that nginx can process it? Thanks to everyone who helps.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
G
gaelpa, 2011-09-26
@baltazorbest

In general, what specific problem are you trying to solve with such manipulations?
Regarding the question, maybe ngx_http_ssi_module will help you .
Or maybe something like this is needed?

A
andoriyu, 2011-09-27
@andoriyu

Nginx can make requests to memcached and redis. Let nginx take the proxy_pass value from redis.

G
gaelpa, 2011-09-26
@gaelpa

PHP on apache_mod_php or FastCGI?
For the first case: proxy_set_header will come to $_SERVER['HTTP_*']
For the second case, fastcgi_param will come somewhere in theory, I didn't check it myself.

M
Masterkey, 2011-09-26
@Masterkey

Keep it simple
mickeyben.com/2009/12/30/using-nginx-as-a-load-balancer.html
wiki.nginx.org/LoadBalanceExample
And don't ask anything from servers

P
Perkov, 2011-09-26
@Perkov

When changing proxy_pass, nginx also needs to be distorted. Can it be easier to generate a new config (or part of it) for nginx using php?

B
BasilioCat, 2011-09-26
@BasilioCat

Measure server load from php, use nginx as a load balancer... Don't you want to look for tools specifically designed to solve such problems? Maybe ipvs, haproxy will suit you?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question