PHP-FPM will not work over TCP socket. No idea why
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I updated my CentOS distribution a little bit back, and was surprised to find my nginx wordpress website and my seafile server not working and giving error 504 timeouts.. After a while, I was able to fix the issue for the website by switching the php socket from 127.0.0.1:9000 to server unix:/var/run/php5-fpm.sock; like so:
upstream php
server unix:/var/run/php5-fpm.sock;
server 127.0.0.1:9000;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
And changing the www.conf respectively.
; Start a new pool named 'www'.
[www]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address
on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock
; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0666
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
[snip]
This solved the issue for my wordpress nginx server, but will not solve the issue for my seafile server. I have figured out that the program seafile starts 2 tcp sockets on 127.0.0.1:8000 and 127.0.0.1:8082, yet no matter what I can do, they seem to timeout. I don't know how to change these tcp sockets in the program to unix sockets; I suspect it might be impossible.
Relatedly, I could not seem to login to my mariadb mysql databases if I used `127.0.0.1' as my ip. I could however login if I used 'localhost', and had to change the logins for both wordpress and seafile respectively.
Any idea why this might be happening? What in centos is stopping me from access local sockets like this?
centos php nginx
New contributor
|
show 1 more comment
up vote
0
down vote
favorite
I updated my CentOS distribution a little bit back, and was surprised to find my nginx wordpress website and my seafile server not working and giving error 504 timeouts.. After a while, I was able to fix the issue for the website by switching the php socket from 127.0.0.1:9000 to server unix:/var/run/php5-fpm.sock; like so:
upstream php
server unix:/var/run/php5-fpm.sock;
server 127.0.0.1:9000;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
And changing the www.conf respectively.
; Start a new pool named 'www'.
[www]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address
on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock
; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0666
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
[snip]
This solved the issue for my wordpress nginx server, but will not solve the issue for my seafile server. I have figured out that the program seafile starts 2 tcp sockets on 127.0.0.1:8000 and 127.0.0.1:8082, yet no matter what I can do, they seem to timeout. I don't know how to change these tcp sockets in the program to unix sockets; I suspect it might be impossible.
Relatedly, I could not seem to login to my mariadb mysql databases if I used `127.0.0.1' as my ip. I could however login if I used 'localhost', and had to change the logins for both wordpress and seafile respectively.
Any idea why this might be happening? What in centos is stopping me from access local sockets like this?
centos php nginx
New contributor
from/to which version you have updated the centos? did you check php config file? seafile config file?
– malyy
20 hours ago
I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
– Joost Ziff
20 hours ago
During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
– malyy
19 hours ago
Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
– Joost Ziff
19 hours ago
Try to disable SELinux (setenforce 0
) and test again. I guess you need to set the according selinux rules likesetsebool httpd_can_network_connect on
etc.
– Michael D.
18 hours ago
|
show 1 more comment
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I updated my CentOS distribution a little bit back, and was surprised to find my nginx wordpress website and my seafile server not working and giving error 504 timeouts.. After a while, I was able to fix the issue for the website by switching the php socket from 127.0.0.1:9000 to server unix:/var/run/php5-fpm.sock; like so:
upstream php
server unix:/var/run/php5-fpm.sock;
server 127.0.0.1:9000;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
And changing the www.conf respectively.
; Start a new pool named 'www'.
[www]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address
on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock
; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0666
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
[snip]
This solved the issue for my wordpress nginx server, but will not solve the issue for my seafile server. I have figured out that the program seafile starts 2 tcp sockets on 127.0.0.1:8000 and 127.0.0.1:8082, yet no matter what I can do, they seem to timeout. I don't know how to change these tcp sockets in the program to unix sockets; I suspect it might be impossible.
Relatedly, I could not seem to login to my mariadb mysql databases if I used `127.0.0.1' as my ip. I could however login if I used 'localhost', and had to change the logins for both wordpress and seafile respectively.
Any idea why this might be happening? What in centos is stopping me from access local sockets like this?
centos php nginx
New contributor
I updated my CentOS distribution a little bit back, and was surprised to find my nginx wordpress website and my seafile server not working and giving error 504 timeouts.. After a while, I was able to fix the issue for the website by switching the php socket from 127.0.0.1:9000 to server unix:/var/run/php5-fpm.sock; like so:
upstream php
server unix:/var/run/php5-fpm.sock;
server 127.0.0.1:9000;
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Load modular configuration files from the /etc/nginx/conf.d directory.
# See http://nginx.org/en/docs/ngx_core_module.html#include
# for more information.
include /etc/nginx/conf.d/*.conf;
And changing the www.conf respectively.
; Start a new pool named 'www'.
[www]
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address
on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses on a
; specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php5-fpm.sock
; Set listen(2) backlog. A value of '-1' means unlimited.
; Default Value: -1
;listen.backlog = -1
; List of ipv4 addresses of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
listen.allowed_clients = 127.0.0.1
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0666
;listen.owner = nobody
;listen.group = nobody
;listen.mode = 0666
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
; RPM: apache Choosed to be able to access some dir as httpd
user = apache
; RPM: Keep a group allowed to write in log dir.
group = apache
[snip]
This solved the issue for my wordpress nginx server, but will not solve the issue for my seafile server. I have figured out that the program seafile starts 2 tcp sockets on 127.0.0.1:8000 and 127.0.0.1:8082, yet no matter what I can do, they seem to timeout. I don't know how to change these tcp sockets in the program to unix sockets; I suspect it might be impossible.
Relatedly, I could not seem to login to my mariadb mysql databases if I used `127.0.0.1' as my ip. I could however login if I used 'localhost', and had to change the logins for both wordpress and seafile respectively.
Any idea why this might be happening? What in centos is stopping me from access local sockets like this?
centos php nginx
centos php nginx
New contributor
New contributor
edited 20 hours ago
New contributor
asked 22 hours ago
Joost Ziff
11
11
New contributor
New contributor
from/to which version you have updated the centos? did you check php config file? seafile config file?
– malyy
20 hours ago
I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
– Joost Ziff
20 hours ago
During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
– malyy
19 hours ago
Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
– Joost Ziff
19 hours ago
Try to disable SELinux (setenforce 0
) and test again. I guess you need to set the according selinux rules likesetsebool httpd_can_network_connect on
etc.
– Michael D.
18 hours ago
|
show 1 more comment
from/to which version you have updated the centos? did you check php config file? seafile config file?
– malyy
20 hours ago
I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
– Joost Ziff
20 hours ago
During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
– malyy
19 hours ago
Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
– Joost Ziff
19 hours ago
Try to disable SELinux (setenforce 0
) and test again. I guess you need to set the according selinux rules likesetsebool httpd_can_network_connect on
etc.
– Michael D.
18 hours ago
from/to which version you have updated the centos? did you check php config file? seafile config file?
– malyy
20 hours ago
from/to which version you have updated the centos? did you check php config file? seafile config file?
– malyy
20 hours ago
I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
– Joost Ziff
20 hours ago
I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
– Joost Ziff
20 hours ago
During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
– malyy
19 hours ago
During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
– malyy
19 hours ago
Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
– Joost Ziff
19 hours ago
Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
– Joost Ziff
19 hours ago
Try to disable SELinux (
setenforce 0
) and test again. I guess you need to set the according selinux rules like setsebool httpd_can_network_connect on
etc.– Michael D.
18 hours ago
Try to disable SELinux (
setenforce 0
) and test again. I guess you need to set the according selinux rules like setsebool httpd_can_network_connect on
etc.– Michael D.
18 hours ago
|
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.
Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.
Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.
Joost Ziff is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f481395%2fphp-fpm-will-not-work-over-tcp-socket-no-idea-why%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
from/to which version you have updated the centos? did you check php config file? seafile config file?
– malyy
20 hours ago
I didn't do anything fancy. Just a yum upgrade, so it surprised me that anything weird happened. As for the php config file, I mostly just edited the www.conf. See the above edit.
– Joost Ziff
20 hours ago
During the upgrade it should ask yoy if you want to keep local config files or update them from ccontributor. Seems like files were updated.
– malyy
19 hours ago
Certainly, I imagine that is the case. but I cannot imagine what got changed. After all, what would cause php-fpm to work with a unix socket, but not with a tcp socket?
– Joost Ziff
19 hours ago
Try to disable SELinux (
setenforce 0
) and test again. I guess you need to set the according selinux rules likesetsebool httpd_can_network_connect on
etc.– Michael D.
18 hours ago