• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

nginx + php-fpm not show my wordpress website

tomer628

Basic Pleskian
hi..
i have Plesk 12.5 in Ovh hosting
i installed nginx via Updates and Upgrade

but the PROBLEM is :
if i checked the boxs of Nginx , under "Apache & Nginx settings" + php 7 confiurated "php-fpm application served by nginx " my wordpress website not work
it just show the default plesk page

how can i fix it ?
 
Hi,

The problem is that WordPress does not provide nginx configs out of the box, so it's not a recommended (or easy) way to run WordPress. I'd suggest you to us Apache + PHP-FPM instead of nginx, at least for now. We know about the scenario you're trying to achieve, and we're working on supporting it, but again, it's not something easily done.
 
Sounds like you have "pretty permalinks", try adding...
Code:
if (!-e $request_filename) {
  rewrite ^.*$ /index.php last;
}

To the Additional Nginx Settings, in "Apache & Nginx Settings".
I hope that helps
Kind regards

Lloyd
 
thank you custer.
can you tell me how can i do that Apache+PHP-FPM (what that you told me..) ?

You'll need Apache 2.4, which is available on CentOS 7, Ubuntu 14 and Debian 8.
The rest is rather self-explanatory:
upload_2016-2-18_14-26-11.png

Let me know if you have any questions. Also, Lloyd's solution is definitely worth a try (thanks, @Lloyd_mcse).
 
ok..
fisrt, i tried the solution of Lloyd's ,but same problem exist.. (enayway thanks for your gave me an idea)
about your picture , i forgot to tell i have Centos 6.7, so :

1. if i reinstall my Vps to Ubuntu 14.04 (with Plesk 12 come with OVH), should i make a backup to my plesk before the delete my server ?
OR better to do a clean installtion and configuration ?
2. there is a different between Centos to Ubuntu (this first time for me with Ubuntu) ?
 
0. What exactly is your goal? If you need PHP-FPM and PHP 7, that's one thing. If you need your WordPress instance to simply be secure and work fast, that's a bit different (you can try FastCGI instead of PHP-FPM, for example).

1. Do you have any data you don't want to lose on your current server or it's more or less a fresh empty server? If you do have data, I'd absolutely recommend backing it all up. If you don't have any data, simply making a fresh VPS with a different OS is OK.

2. CentOS is rpm-based, Ubuntu is deb-based, so there might be quite a difference (depending on how comfortable you are with Linux command-line - if you do all your stuff only from within Plesk, the difference is relatively minimal).
 
thanks for all informations. :)
about the PHP- - i saw php-fpm has high performance + low memory
and Fast-CGI has high performance + high memory
so it's sound like PHP-FPM this the best (didn't ?)..
 
When I upgraded to Plesk 12.5, I had to use...
Code:
try_files $uri $uri/ /index.php?q=$request_uri;


Then moved to PHP7 and had to use, the one I mentioned earlier.
One of them should work for you :)
Here's the source - https://wordpress.org/support/topic/wordpress-permalinks-on-nginx.

Oh and if you have Yoast SEO here's what I've been using...
Code:
# Wordpress SEO
rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;


Hope that helps.
Kind regards

Lloyd
 
@Lloyd_mcse

You mentioned that you had two kinds of "solutions": try_files $uri $uri/ /index.php?q=$request_uri; and if (!-e $request_filename) { rewrite ^.*$ /index.php last;}

Actually, they are both concerning different topics or issues with WordPress (henceforth: WP).

Nevertheless, note the following:

a) the Nginx "try_files" directive is not necessary for a standard WP instance: the default Nginx configuration should work like a charm.

The fact that you have to specify the q variable, indicates two things: an issue with WP permalinks and the reason thereof, being "ugly" custom code that uses custom query variables (note: q is not a default WP query variable).

In short, your situation (in which the Nginx "try_files" directive) is required, is not a standard situation, applying to all WP instances.

b) Nginx is rather fussy about proper execution of directives and that requires that specific "bad things" should be prevented in Nginx configuration.

For instance, "if is bad" is a standard statement in the Nginx world: prevent any if in the Nginx configuration files.

The block

if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}


is rather strange: it contains an "if", a "rewrite" and a condition "if file exists".

Why strange? Well, note that

- Nginx checks file, directory and file extension pattern matches with location directives,
- Nginx allows "if" in location blocks,

and the above implies essentially that the specific location block has not been used to it´s full potential.

Why using the "if" statement then? Well, one seemed to observe the necessity to check for the existence of a specific file and return index.php if the file does not exist.

Again, WP is quite advanced and a proper functioning permalink setting will not require this "test and rewrite", unless the permalink function is not working or broken by "ugly" code.

This (again) implies that your situation is not a standard situation, as noticed under point a.

Furthermore, the whole "if block" is bad practice from the Nginx perspective: just use a "try_files" directive, since that does the same "test and rewrite" more efficiently.


I hope that the above helps a bit in fine-tuning your Nginx configuration for the non-standard situation of your WP instance.

Regards....
 
ok..
fisrt, i tried the solution of Lloyd's ,but same problem exist.. (enayway thanks for your gave me an idea)
about your picture , i forgot to tell i have Centos 6.7, so :

1. if i reinstall my Vps to Ubuntu 14.04 (with Plesk 12 come with OVH), should i make a backup to my plesk before the delete my server ?
OR better to do a clean installtion and configuration ?
2. there is a different between Centos to Ubuntu (this first time for me with Ubuntu) ?

@tomer628

You can follow the steps indicated by @custer, irregardless of the OS you are running.

In short, you do not have to change the OS, just apply the "php-fpm served by Apache" setting.

If any problems persist, let me know.

Regards...
 
Oh, my bad, thought it said "show the home page" not default Plesk page, serves me right for not finding my glasses first lol
Ignore me :)

But yeah +1 for Apache+FPM
 
i have
@tomer628

You can follow the steps indicated by @custer, irregardless of the OS you are running.

In short, you do not have to change the OS, just apply the "php-fpm served by Apache" setting.

If any problems persist, let me know.

Regards...
thanks for you reply..
i have just 2 options here (and php-fpm served by Apache not one of them)
 
@tomer628

If I am not mistaken and you have two options, than you are probably having an "older" PHP version, is that correct?

Anyway, for the latest WP versions (WP > 4.4) it is strongly recommend to use PHP 7.0.x, you can install that with the Plesk installer.

When having selected PHP version 7.0.x (or even 5.6.x), you should have the choice between three options with respect to FPM.

Can you report which options you DO have?

Regards...
 
@tomer628

Can you run the command: service plesk-php70-fpm status (from the command line)

If it is not running, try to start it and see what happens. If that does not work, than report (in detail) what has happened and what output can be found in the log lines.

Anyway, keep me posted..

Regards
 
Code:
# service plesk-php70-fpm status
php-fpm is stopped
so i tried to enable it:
Code:
service plesk-php70-fpm start
Starting php-fpm: [18-Feb-2016 17:46:40] WARNING: Nothing matches the include pa                                              ttern '/opt/plesk/php/7.0/etc/php-fpm.d/*.conf' from /opt/plesk/php/7.0/etc/php-                                              fpm.conf at line 119.
[18-Feb-2016 17:46:40] ERROR: No pool defined. at least one pool section must be                                               specified in config file
[18-Feb-2016 17:46:40] ERROR: failed to post process the configuration
[18-Feb-2016 17:46:40] ERROR: FPM initialization failed
                                                           [FAILED]
 
@tomer628

Your output indicates that you do not have a "fpm config file" for the domain, which implies that you can have problems of various kinds.

In general, the fpm config file should be autogenerated, implying that a faulty installation or some error at stop/start time is the most likely root cause of the problem.

If that educated guess is correct, then there is probably more to repair.

For the above reasons, we will follow some steps, in order to get your php-fpm working.

I will start with these questions:

a) did you custom some php.ini file?

b) do you have a file called "php-fpm.sock" in the /var/www/vhosts/system/<FQDN>/ directory? Note: <FQDN> is the full domain name, i.e. <subdomain>.<domain>.tld

If so, remove that file. At this moment, you can try to restart php-fpm (but it will probably not work).

c) use the Plesk Panel and go to "Tools & Settings > PHP Settings" and

- check that you have a "7.0.x FPM application" in the list,
- check that a green symbol is in front of it.

If there is no 7.0.x FPM application mentioned in the list, just install it with the installer. Note: a like to the installer is at the top of the page.

d) check whether the "FPM served by Apache" can be activated on the domain in question. Does that work?

Let me know what the endresult is, otherwise we should take more elaborate measures.

Hope the above helps...

Regards
 
a) no.
b) i have 3 domains:
1. vps123..OVH.NET
2. my domain.com
3.sub.mydomain.com
and just in vps123... was file php-fpm.sock i deleted it + restart the service after restart doesnot work..
also green symbolis exist
d) don't have the FPM 0f Apache, (just FPM-nginx)
 
@tomer628

Let´s hope that it has nothing to do with the VPS at OVH, it certainly is not the first time that OVH has a bit of problem.

Let´s try to "enforce" a start of php-fpm:

a) create the file /opt/plesk/php/7.0/etc/php-fpm.d/<FQDN>.conf and edit the contents to contain (note: replace all <..> with proper values):

[<FQDN>]
prefix = /var/www/vhosts/system/$pool
user = <pleskuser>
group = psacln

listen = php-fpm.sock
listen.owner = root
listen.group = psaserv
listen.mode = 0660

chdir = /

pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
; Following pm.* options are used only when 'pm = dynamic'
pm.start_servers = 1
pm.min_spare_servers = 1
pm.max_spare_servers = 1

catch_workers_output = yes

php_value[memory_limit] = 128M
php_value[max_execution_time] = 60
php_value[max_input_time] = 60
php_value[open_basedir] = "/var/www/vhosts/timeforwood.nu/:/tmp/"
php_value[upload_max_filesize] = 2M
php_value[post_max_size] = 8M

b) run the command: service plesk-php70-fpm start

and check the output.

If that does not work, report the output.

If it does not work, you should probably re-install PHP 7 (that is the fastest way): just remove and install again.

If it does work, then you should try to activate php-fpm via the Plesk Panel AND test for persistency: the problem can return.

So, when having activated the "FPM served by Apache", just switch to FastCgi (or something similar), wait a sec and try to activate the "FPM server by Apache" again.

If that works fine, than everything is ok.

If re-activating still is a problem, just re-install PHP 7.

Hope the above helps!

Regards....
 
Back
Top