504 gateway timeout nginx

  • Hi,


    I'm a new Pagekit user. I've tried to install some extensions in the Marketplace but I'm getting a "504 gateway timeout nginx" message and the installation doesn't complete.


    I asked my host about this but as it is related to a program I installed they are not being helpful.


    I've enabled debugging but that doesn't seem to produce any information.


    I found this on the Plesk support forum https://support.plesk.com/hc/e…ginx-504-Gateway-Time-out:



    Resolution
    Set the directives in Domains > example.com > Apache & nginx Settings > Additional nginx directives :

    proxy_connect_timeout 1200s;
    proxy_send_timeout 1200s;
    proxy_read_timeout 1200s;
    fastcgi_send_timeout 1200s;
    fastcgi_read_timeout 1200s;



    I implemented the above in Plesk but all it has done is changed the message I am getting when installing extensions to this: "Service temporarily unavailable. The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later."

    I would be very grateful for any help - thanks in advance!

    James
  • Hi JamesA and welcome to this forum.


    We will try to help you. Please don‘t be upset, if we are asking you a few „stupid questions“, but this might be possible to solve your problem.


    At first:


    1. Do your logs contain any information?
    2. Is NGINX stand-alone or is it configured as reverse proxy?



    Thanks for your answers :)

  • Hi,


    alright - NGINX is configured as reverse proxy. Okay - so actually the Apache is the web server "behind" NGINX. I guess PHP is executed using Fast-CGI or FPM. PLESK provides log-files. Could you have a look at it? You can see them using the PLESK-interface or (as far as I remember) you find a folder called logs or something like that in your document root.


    This is a bit older, but maybe it helps you finding your logs: https://docs.plesk.com/en-US/o…atistics/log-files.65210/

  • Alright. This error does only occur if you open the marketplace, right?


    Does the page Settings > Extensions work? Is it possible to upload an extension (I just attached an example extension to this post)?


    I checked out the source of the marketplace-view and it's controller. At first I guessed that your provider limits outgoing connections and the call to the marketplace-server fails. But this should be no problem, as it's an AJAX-call, which works in the background...


    pagekit-metadesc.zip

  • Do you mean this page? admin/system/package/extensions


    Yes - the blog extension is already installed.


    Where should I extract the extension files to? Some have the same names and will replace my existing files.


    Cheers

  • Do you mean this page? admin/system/package/extensions


    Right.


    Okay - As far as I remember the blog is installed automatically on every Pagekit installation ;) Please just download the zip, do not extract it. Go to admin/system/package/extensions an click "upload". Select the extension and upload it.


    I don't think the problem is Pagekit-related. I guess your provider blocks something, Pagekit does when you access the marketplace. But we will find out step by step :)

  • Ok, I've tried to upload the zip. The first time, nothing happened, except a blank message window briefly came up at the top of the screen. The second time, the extension started to install, but then the 504 gateway error nginx message appeared again.

  • Well - it's one possibility ;)


    It just means that NGINX is waiting for some service in "the chain".


    And there could be many things causing that NGINX is waiting for something.


    I need to know:


    1. Does this happen on other pages (writing a blog-post, uploading a bunch (5-10) images, ...), too?
    2. If you see the 504-error: Can you switch over to another Pagekit-site (e.g. the admin-dashboard) without having to wait?
  • Okay. I crawled through the pagekit-source and mentioned, that Pagekit calls system.api on all the pages you mentioned the 504.


    There are two possible solutions:


    1. You could switch over from NGINX to Apache (without reverse proxy) and check the logs again
    2. You could try to check if the http-post requests are causing the problem - to do that you need to debug your instance. If you would like to, you could give me FTP-access via private message. Please do a backup before and please do not give me your "root"-user. I am not liable for defects so you should ask yourself, whether you would like to trust somebody you don't know ;)
  • The problem is solved.


    I got a PN from JamesA and he gave me access to ftp and the admin-backend ( JamesA : Please don't forget to reset the passwords) so I was able to debug the Pagekit-instance.


    Turned out that this line caused the 504.


    Digging deeper it turned out that a


    Code
    1. file_get_contents('https://packagist.org');


    was running into timeout. Seemed to be a problem on the web server's config. The provider solved the problem.