Wednesday, July 17, 2019

NGINX PHP-FPM (FastCGI) 504 Gateway Timeout error on


Increase PHP maximum execution time in /etc/php.ini:
  • max_execution_time = 300

  • Increase PHP-FPM request terminate timeout in the pool configuration (/etc/php/7.2/fpm/pool.d/www.conf): 
  • request_terminate_timeout = 300

  • Increase Nginx FastCGI read timeout  under the http section (/etc/nginx/nginx.conf or /etc/nginx/sites-available/nameofvirtualhost): 
  • fastcgi_read_timeout 300;
  • Wednesday, July 3, 2019

    Screenshot of a website



    PhantomJS Installation

    Install PhantomJS on Ubuntu
    sudo apt-get update
    sudo apt-get install build-essential chrpath libssl-dev libxft-dev
    sudo apt-get install libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev
    wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2
    tar xvjf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /usr/local/share/
    sudo ln -sf /usr/local/share/phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin
    phantomjs --version
    2.1.1

    mkdir /path/to/screenshot
    cd /path/to/screenshot
    Copy rasterize.js in the directory where you want the resulting screenshot to take place.
    wget https://raw.githubusercontent.com/ariya/phantomjs/master/examples/rasterize.js
    phantomjs --debug=yes --ignore-ssl-errors=true --ssl-protocol=any --web-security=true rasterize.js https://enews.ssis.edu.vn enews.png "400px*300px" .25

    The last variable is the zoom factor of the website.  In this case .25 means 25% of the website in a 400px by 300px thumbnail.