• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue 503 error when using www prefix as preferred url - php-fpm socket error

Djeex78

New Pleskian
Server operating system version
Debian 11
Plesk version and microupdate number
18.0.51
Hi there, I hope you can help me.

When I choose www as preferred url for a hosting domain (wordpress), I get a 503.

Please find the logs below :
Code:
2023-03-26 23:51:20    Error            (2)No such file or directory: AH02454: FCGI: attempt to connect to Unix domain socket /var/www/vhosts/system/www.mydomain.tld/php-fpm.sock (127.0.0.1:9000) failed                Apache error
2023-03-26 23:51:20    Error            AH01079: failed to make connection to backend: httpd-UDS, referer: https://www.mydomain.tld/            Apache error

PHP version is 8.1.17 and set as "FPM Application served by Apache".

If I set the preferred domain without "www", the website is reachable
If I change FPM to "served by nginx", the website is reachable.
Each time I go back to "www" set with "FPM Application served by Apache", I get the 503 error.

I tried to restart plesk-php81-fpm and reset the php settings (# /usr/local/psa/bin/php_settings -u ), I still get the error.
I tried to change the handler, go back, and then restart the handler and reset the php settings, I still get the error.
I tried to delete the hosting, and recreate it from scratch.
I tried to add www as preferred url on another domain on another subscription, I get the error too.

Code:
/var/www/vhosts/system/mydomain.tld/
does exist,
Code:
/var/www/vhosts/system/www.mydomain.tld/
doesn't, even if I choose www as preferred url.

Thanks for your help
 
What is your URL setting in Wordpress? If you force a specific spelling, you must make sure that in Wordpress exactly the same is set, no other variation of the URL.
 
Wordpress handle both, it always has. And there isn't any .htaccess specific rules. And as I explained, any other php-m handler does it right.
It's all about www prefix and php-m handler, who is looking for the wrong socket folder or does'nt create the good one. I don't know if this bug is from a plesk update, or an issue from a previous migration I did one month ago.
 
Wordpress handle both,
Wordpress cannot have two home and siteurl domains. It can only have one. Hence it cannot handle both if the web server dicates one setting. Have you verified that in Wordpress the exactly same URL is set that the web server enforces, meaning that in wordpress you have defined the home and siteurl in the www spelling?
 
I think it is not about home.

When you set "www as preferred url" in Plesk hosting settings it doesn't change the home directory, it's strictly the same. It's all about 301 url redirection, isn't it ?
Anyway, i've checked twice, wordpress home settings match plesk one. and it works perfectly well with php-fpm served by nginx. And it worked perfectly well on my previous server with php-fpm served by Apache.

The problem is that when you set php-m served by Apache, it's looking for a socket in the wrong system directory. It's looking for a vhost system folder that doesn't exist, with www. prefix, and I think it should not. And if it should, then php-fpm handler should have created the folder.

Right now, I could use two workaround :
- let nginx handler instead of Apache
or
- use custom rules to redirect wordpress urls to www. I tried it, it doesn't seem to affect php-m socket.

But that's not something I would deploy permanently on my 50+ hostings.
 
I have no records and from production servers no indication that there are any issues with the www Alias. It is simply an alias. Have you looked into /var/www/vhosts/system/conf/httpd.conf to check how the configuration looks? Did you by chance add a "www" in front of the domain name that was entered as the domain? So that the www subdomain ends up as www.www.<domainname>?
 
httpd.conf and domains names are fine.
The fact is when I choose www alias via plesk, with php-fpm served by Apache, it looks for a socket system folder that doesn't exist. When I untick the alias, it looks for the good folder.
So, perhaps it's a bug (some conf file server wide, altered by the previous migration ?) or perhaps it's more than just an alias...
 
Could you please provide an example on these folder names? It does not and should not give the real domain name for privacy reasons, but if the pattern including case-sensitivity could be provided it will make things easier to comprehend.
 
Back
Top