• 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

Question proxy_pass php

andyxyz

Basic Pleskian
Hi all,

This is driving me CRAZY!!

I am trying to use the following to proxy off a sub folder eg example.co.uk/blog to wordpress on wordpress.example.co.uk

location /blog {
proxy_pass http://wordpress.example.co.uk/;
}

text / image / html / work fine

however, any php file does not work and it looks like nginx tries to process php locally

[crit] 24184#0: *67578 connect() to unix:///var/www/vhosts/system/example.co.uk/php-fpm.sock failed (2: No such file or directory) while connecting to upstream

apache is off (Proxy mode disabled) so only nginx in use,

what am I missing?
 
It might not be enough to switch Apache off. You will need to set PHP to "PHP-FPM via Nginx", too. Else, .php-requests will be forwarded to Apache. As Apache is not acitve, this fails and causes the "error connecting to upstream" that you are seeing. The setting needs to be done even if you are not processing PHP on your local server. The key is that .php traffic must not be filtered out by Nginx and directed to the (missing) Apache server before the location rule is reached.

Edit: Another solution might be to turn off PHP completely. It won't be served by your Plesk system anyway but by the external system. Whether this is a good solution depends on whether you need PHP on your local web space for other directories or not.
 
sorry.. should have said.. yes php is set to be managed by nginx (they recently fixed the bug where turning apache off would cause a error if you left php running as apache.. now turning off proxy automatically sets php to nginx also which is cool)

Disabling php is an interesting idea.. however, it had no effect (other than to change the error)

503 GET /blog/php.php HTTP/1.1
 
Last edited:
Back
Top