[SOLVED] understanding apache proxy unix sockets with pipe localhost
Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My question is, why is it necessary to pipe the socket into the fcgi://localhost/? How does it work exactly?
FPM is not "part" of Apache but an external service. The daemon usually listens on a UNIX socket, meaning not exposed to the 'net but confined to localhost and w/o TCP protocol overhead. To be able to hand off jobs to it you must also speak the right protocol and that's FCGI.
Quote:
Originally Posted by vincix
Where does apache take the meaning of 'fcgi' from in this context? From proxy_fcgi_module? Or from fastcgi_module? Or both?
I loved the phrase "hand off jobs"... really on the nose ) (I know - or I think I know - it wasn't intentional, but still quite funny!)
Well, I kind of already read what you're linking to and other similar resources (not that a reread would hurt). My question is a little bit less naive than it seems to be, or at least that's what I like to believe. In a way it has more to do with the way unix sockets work. If php-fpm uses unix-sockets, isn't it redundant to pipe it into localhost? I mean, could you normally set up a communication session between two apps through unix sockets some other way than on the same localhost? I'm guessing 'localhost' is more related to 'fcgi', meaning that in order to bind the php-fpm unix socket to the fcgi, you simply need to add the fcgi syntax that presupposes specifying localhost - which otherwise would use a tcp socket. Does that make sense?
So apache knows to interpret the special meaning of 'fcgi' using the proxy_fcgi_module, right? But I had used mod_php and fastcgi_module, then it would have used this latter module to interpret it? Or it wouldn't make sense using it in this context?
I loved the phrase "hand off jobs"... really on the nose ) (I know - or I think I know - it wasn't intentional, but still quite funny!)
It is as that's exactly how it works: dump a job, hope it timely returns a usable payload.
Quote:
Originally Posted by vincix
If php-fpm uses unix-sockets, isn't it redundant to pipe it into localhost? I mean, could you normally set up a communication session between two apps through unix sockets some other way than on the same localhost? I'm guessing 'localhost' is more related to 'fcgi', meaning that in order to bind the php-fpm unix socket to the fcgi, you simply need to add the fcgi syntax that presupposes specifying localhost - which otherwise would use a tcp socket. Does that make sense?
Yes but we look at it from different angles. Indeed where the socket lives doesn't matter, it could have been "loadbalancer.fpm-pool-3.yourdo.main", but it isn't redundant. (Remove it and see if it still works? ;-p) And "fcgi://" is only related to location in the sense of the "incantation" needed to summon this lesser daemon in its known location: you shan't talk dav:// to it, nor bitcoin:// nor ed2k://, only fcgi://.
Quote:
Originally Posted by vincix
So apache knows to interpret the special meaning of 'fcgi' using the proxy_fcgi_module, right? But I had used mod_php and fastcgi_module, then it would have used this latter module to interpret it?
If you'd use the latter then you'd prolly use a different syntax but it would know how to interpret things, yes.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.