L
L
link772018-07-19 19:23:45
Nginx
link77, 2018-07-19 19:23:45

How can the nginx balancer "teach" to give a static page, for example index.php?

Good afternoon.
Please tell me whether it is possible to replace the index.php page on the nginx balancer, and send requests to other pages to upstreams.
Thanks in advance :)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Danila Vershinin, 2018-07-19
@link77

In the code below: nginx first checks for the exact specified address (with an equals sign). Everything else will not match and will be proxied.

server {
  root ...;
  index index.php;
  location = /index.php {
    # do what you want with it
    fastcgi_pass /path/to/fpm/sock/file;
  }

  location / {
    # not matching /index.php here, so passing over to upstream
    proxy_pass http://your.upstream/;
    ...
  }    
}

W
Wexter, 2018-07-19
@Wexter

and what is the problem?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question