There is an internal network where several virtual machines are located.One of these virtual machines is nginx proxies in front of several sites on other virtual machines that run on nginx.There is no problem, but I want nginx to proxy directly to fpm on another server.How to correctly configure the config nginx in that case?
For example:
nginx stands on a server with internal ip
php-fpm on server with ip
On fpm is the site in the directory /var/www/
  • And what's the problem? fastcgi_pass perfectly accepts network addresses – Hungry5 Nov 8 '19 at 09:53

1 Answers 1

location ~ \ .php ${
        try_files $uri=404;
        fastcgi_split_path_info ^(.+ \.php)(/.+) $;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root $fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
  • Traditional mindless copy-paste.
    Well, what do try_files do here?
    – Hungry5 Nov 8 '19 at 10:30
  • Where does $document_root lead to? Or for root do you specify the local path on the server with nginx? – Obsessive-Compulsive68 Nov 8 '19 at 10:52
  • [[Lynn]], this try_files can also be brought up one level.Or is it the meaning itself? – Dark Dove Nov 8 '19 at 11:01
  • [[Urichalex]],
    At fpm is the site in the directory /var/www/

    I didn’t read it.It was supposed that the code lies on and you just need to increase the power of fpm.

    Then another option is better: Nginx reverse proxy.
    On, configure Nginx as a regular site.
    On Nginx you configure as reverse proxy through proxy_pass.

    Then traffic falling to 0.1 will be transparently proxied to 0.2
    – Dark Dove Nov 8 '19 at 11:04
  • [[Fixid]], to me the very meaning is how you understand it. – Hungry5 Nov 8 '19 at 11:16