• 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.

Wkhtmltopdf always resolves /var/www/vhosts/default/htdocs/index.html

Joe_Knighting

New Pleskian
Hi,

I am running wkhtmltopdf on one of my CentOS 6 boxes running Plesk 12.

I have used Plesk since version 10 and up until November 2014 this worked as expected.

Wkhtmltopdf is a tool that uses webkit to generate a PDF version of a web page using command line. It works as expected for all sites that are not hosted on the same server that it is running on. However for anything local it will always resolve the same file as a PDF. (/var/www/vhosts/default/htdocs/index.html)

I have tried adding the domain with loopback to /etc/hosts file as suggested on the wkhtmltopdf Github Issue tracker, however after pinging the domain, although this does change the domain from resolving the external IP of the server to the loopback address (127.0.0.1) the same page is always found and generated by wkhtmltopdf.

I'm sure this is an issue with Plesk's virtual hosts, but I'm not sure where to start to try to identify the problem? Does anyone have any ideas or could give me some advice please?
 
From suggestion on the wkhtmltopdf issue tracker, to eliminate it as the problem I tried the following:-

Code:
wget -O /tmp/test 'http://www.domain.com'

This returns the same redirect page found in /var/www/vhosts/default/htdocs

Therefore it must be an issue with the configuration within Plesk/CentOS. Can anyone suggest anything?
 
More info, this is a problem with Nginx I believe. If I run:

Code:
curl -v -i www.domain.co.uk

Which returns this:

Code:
* About to connect() to www.domain.co.uk port 80 (#0)
*   Trying 2001:8d8:867:6e00::36:75af... connected
* Connected to www.domain.co.uk (2001:8d8:867:6e00::36:75af) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.2.3 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: www.domain.co.uk
> Accept: */*
>
< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Server: nginx
Server: nginx
< Date: Tue, 17 Feb 2015 17:51:03 GMT
Date: Tue, 17 Feb 2015 17:51:03 GMT
< Content-Type: text/html
Content-Type: text/html
< Content-Length: 331
Content-Length: 331
< Connection: keep-alive
Connection: keep-alive
< Last-Modified: Tue, 17 Feb 2015 10:21:46 GMT
Last-Modified: Tue, 17 Feb 2015 10:21:46 GMT
< ETag: "200ff-14b-50f4611e68280"
ETag: "200ff-14b-50f4611e68280"
< Accept-Ranges: bytes
Accept-Ranges: bytes
< X-Powered-By: PleskLin
X-Powered-By: PleskLin

<
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Automatic Re-Direct</title>
</HEAD>
<BODY>
<a href="#">Click here if you are not automatically re-directed!</a>
</BODY>
* Connection #0 to host www.domain.co.uk left intact
* Closing connection #0
</HTML>

My freshly created reverse proxy Nginx .conf file for domain.co.uk:

Code:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.

server {
    listen 87.1.0.0:443 ssl;

    server_name domain.co.uk;
    server_name www.domain.co.uk;
    server_name ipv4.domain.co.uk;

    ssl_certificate             /usr/local/psa/var/certificates/certoCkrwer;
    ssl_certificate_key         /usr/local/psa/var/certificates/certoCkrwer;
    ssl_session_timeout         5m;

    ssl_protocols               SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers                 HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers   on;

    client_max_body_size 128m;

    root "/var/www/vhosts/domain.co.uk/httpdocs";
    access_log "/var/www/vhosts/system/domain.co.uk/logs/proxy_access_ssl_log";
    error_log "/var/www/vhosts/system/domain.co.uk/logs/proxy_error_log";

    location / {
        proxy_pass https://87.1.0.0:7081;
        proxy_set_header Host             $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header X-Accel-Internal /internal-nginx-static-location;
        access_log off;
    }

    location /internal-nginx-static-location/ {
        alias /var/www/vhosts/domain.co.uk/httpdocs/;
        add_header X-Powered-By PleskLin;
        internal;
    }

}

server {
    listen 80;

    server_name domain.co.uk;
    server_name www.domain.co.uk;
    server_name ipv4.domain.co.uk;

    client_max_body_size 128m;

    root "/var/www/vhosts/domain.co.uk/httpdocs";
    access_log "/var/www/vhosts/system/domain.co.uk/logs/proxy_access_log";
    error_log "/var/www/vhosts/system/domain.co.uk/logs/proxy_error_log";

    location / {
        proxy_pass http://localhost:7080;
        proxy_set_header Host             $host;
        proxy_set_header X-Real-IP        $remote_addr;
        proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header X-Accel-Internal /internal-nginx-static-location;
        access_log off;
    }

    location /internal-nginx-static-location/ {
        alias /var/www/vhosts/domain.co.uk/httpdocs/;
        add_header X-Powered-By PleskLin;
        internal;
    }

}
 
My httpd .conf file for the same domain.co.uk:

Code:
#ATTENTION!
#
#DO NOT MODIFY THIS FILE BECAUSE IT WAS GENERATED AUTOMATICALLY,
#SO ALL YOUR CHANGES WILL BE LOST THE NEXT TIME THE FILE IS GENERATED.
#IF YOU REQUIRE TO APPLY CUSTOM MODIFICATIONS, PERFORM THEM IN THE FOLLOWING FILES:
#/var/www/vhosts/system/domain.co.uk/conf/vhost.conf
#/var/www/vhosts/system/domain.co.uk/conf/vhost_ssl.conf
<IfModule mod_ssl.c>

    <VirtualHost 87.1.0.0:7081 >
        ServerName "domain.co.uk:443"
        ServerAlias "www.domain.co.uk"
        ServerAlias "ipv4.domain.co.uk"
        ServerAdmin "[email protected]"
        UseCanonicalName Off

        DocumentRoot "/var/www/vhosts/domain.co.uk/httpdocs"
        CustomLog /var/www/vhosts/system/domain.co.uk/logs/access_ssl_log plesklog
        ErrorLog "/var/www/vhosts/system/domain.co.uk/logs/error_log"

        <IfModule mod_suexec.c>
            SuexecUserGroup "cardiffaudi" "psacln"
        </IfModule>

        <IfModule mod_userdir.c>
            UserDir "/var/www/vhosts/domain.co.uk/web_users"
        </IfModule>

        <IfModule mod_sysenv.c>
            SetSysEnv PP_VHOST_ID "861f425b-8cd9-49f3-931c-fa74ce9387b2"
        </IfModule>

        ScriptAlias "/cgi-bin/" "/var/www/vhosts/domain.co.uk/httpdocs/cgi-bin/"

        Alias "/plesk-stat" "/var/www/vhosts/system/domain.co.uk/statistics"
        <Location  /plesk-stat/>
            Options +Indexes
        </Location>
        <Location  /plesk-stat/logs/>
            Require valid-user
        </Location>
        Alias /webstat /var/www/vhosts/system/domain.co.uk/statistics/webstat
        Alias /webstat-ssl /var/www/vhosts/system/domain.co.uk/statistics/webstat-ssl
        Alias /ftpstat /var/www/vhosts/system/domain.co.uk/statistics/ftpstat
        Alias /anon_ftpstat /var/www/vhosts/system/domain.co.uk/statistics/anon_ftpstat
        Alias /awstats-icon /var/www/html/awstats/icon

        SSLEngine on
        SSLVerifyClient none
        SSLCertificateFile /usr/local/psa/var/certificates/certoCkrwer

        SetEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/domain.co.uk/etc/php.ini
        SetEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi

        <IfModule mod_fcgid.c>
            FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/domain.co.uk/etc/php.ini
            FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi
            FcgidMaxRequestLen 134217728
        </IfModule>

        <Directory /var/www/vhosts/domain.co.uk/httpdocs>

            <IfModule mod_perl.c>
                <Files ~ (\.pl$)>
                    SetHandler perl-script
                    PerlHandler ModPerl::Registry
                    Options +ExecCGI
                    allow from all
                    PerlSendHeader On
                </Files>
            </IfModule>
            <IfModule mod_python.c>
                <Files ~ (\.py$)>
                    SetHandler python-program
                    PythonHandler mod_python.cgihandler
                </Files>
            </IfModule>
            <IfModule mod_fcgid.c>
                <Files ~ (\.fcgi$)>
                    SetHandler fcgid-script
                    Options +ExecCGI
                </Files>
            </IfModule>
            <IfModule mod_fcgid.c>
                <Files ~ (\.php$)>
                    SetHandler fcgid-script
                    FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
                    Options +ExecCGI
                </Files>
            </IfModule>

            SSLRequireSSL

            Options -Includes +ExecCGI

        </Directory>

        <Directory "/var/www/vhosts/system/domain.co.uk/statistics">
            AuthType Basic
            AuthName "Domain statistics"
            AuthUserFile "/var/www/vhosts/system/domain.co.uk/pd/d..httpdocs@plesk-stat"
            require valid-user
        </Directory>

        Alias /error_docs /var/www/vhosts/domain.co.uk/error_docs
        ErrorDocument 400 /error_docs/bad_request.html
        ErrorDocument 401 /error_docs/unauthorized.html
        ErrorDocument 403 /error_docs/forbidden.html
        ErrorDocument 404 /error_docs/not_found.html
        ErrorDocument 500 /error_docs/internal_server_error.html
        ErrorDocument 405 /error_docs/method_not_allowed.html
        ErrorDocument 406 /error_docs/not_acceptable.html
        ErrorDocument 407 /error_docs/proxy_authentication_required.html
        ErrorDocument 412 /error_docs/precondition_failed.html
        ErrorDocument 414 /error_docs/request_uri_too_long.html
        ErrorDocument 415 /error_docs/unsupported_media_type.html
        ErrorDocument 501 /error_docs/not_implemented.html
        ErrorDocument 502 /error_docs/bad_gateway.html
        ErrorDocument 503 /error_docs/maintenance.html

        <IfModule mod_security2.c>
        </IfModule>

    </VirtualHost>

</IfModule>

<VirtualHost 87.1.0.0:7080 >
    ServerName "domain.co.uk:80"
    ServerAlias "www.domain.co.uk"
    ServerAlias "ipv4.domain.co.uk"
    ServerAdmin "[email protected]"
    UseCanonicalName Off

    DocumentRoot "/var/www/vhosts/domain.co.uk/httpdocs"
    CustomLog /var/www/vhosts/system/domain.co.uk/logs/access_log plesklog
    ErrorLog "/var/www/vhosts/system/domain.co.uk/logs/error_log"

    <IfModule mod_suexec.c>
        SuexecUserGroup "cardiffaudi" "psacln"
    </IfModule>

    <IfModule mod_userdir.c>
        UserDir "/var/www/vhosts/domain.co.uk/web_users"
    </IfModule>

    <IfModule mod_sysenv.c>
        SetSysEnv PP_VHOST_ID "861f425b-8cd9-49f3-931c-fa74ce9387b2"
    </IfModule>

    ScriptAlias "/cgi-bin/" "/var/www/vhosts/domain.co.uk/httpdocs/cgi-bin/"

    Redirect permanent /plesk-stat https://domain.co.uk/plesk-stat
    Redirect permanent /webstat https://domain.co.uk/webstat
    Redirect permanent /webstat-ssl https://domain.co.uk/webstat-ssl
    Redirect permanent /ftpstat https://domain.co.uk/ftpstat
    Redirect permanent /anon_ftpstat https://domain.co.uk/anon_ftpstat
    Redirect permanent /awstats-icon https://domain.co.uk/awstats-icon

    <IfModule mod_ssl.c>
        SSLEngine off
    </IfModule>

    SetEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/domain.co.uk/etc/php.ini
    SetEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi

    <IfModule mod_fcgid.c>
        FcgidInitialEnv PP_CUSTOM_PHP_INI /var/www/vhosts/system/domain.co.uk/etc/php.ini
        FcgidInitialEnv PP_CUSTOM_PHP_CGI_INDEX fastcgi
        FcgidMaxRequestLen 134217728
    </IfModule>

    <Directory /var/www/vhosts/domain.co.uk/httpdocs>

        <IfModule mod_perl.c>
            <Files ~ (\.pl$)>
                SetHandler perl-script
                PerlHandler ModPerl::Registry
                Options +ExecCGI
                allow from all
                PerlSendHeader On
            </Files>
        </IfModule>
        <IfModule mod_python.c>
            <Files ~ (\.py$)>
                SetHandler python-program
                PythonHandler mod_python.cgihandler
            </Files>
        </IfModule>
        <IfModule mod_fcgid.c>
            <Files ~ (\.fcgi$)>
                SetHandler fcgid-script
                Options +ExecCGI
            </Files>
        </IfModule>
        <IfModule mod_fcgid.c>
            <Files ~ (\.php$)>
                SetHandler fcgid-script
                FCGIWrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper .php
                Options +ExecCGI
            </Files>
        </IfModule>

        Options -Includes +ExecCGI

    </Directory>

    <Directory "/var/www/vhosts/system/domain.co.uk/statistics">
        AuthType Basic
        AuthName "Domain statistics"
        AuthUserFile "/var/www/vhosts/system/domain.co.uk/pd/d..httpdocs@plesk-stat"
        require valid-user
    </Directory>

    Alias /error_docs /var/www/vhosts/domain.co.uk/error_docs
    ErrorDocument 400 /error_docs/bad_request.html
    ErrorDocument 401 /error_docs/unauthorized.html
    ErrorDocument 403 /error_docs/forbidden.html
    ErrorDocument 404 /error_docs/not_found.html
    ErrorDocument 500 /error_docs/internal_server_error.html
    ErrorDocument 405 /error_docs/method_not_allowed.html
    ErrorDocument 406 /error_docs/not_acceptable.html
    ErrorDocument 407 /error_docs/proxy_authentication_required.html
    ErrorDocument 412 /error_docs/precondition_failed.html
    ErrorDocument 414 /error_docs/request_uri_too_long.html
    ErrorDocument 415 /error_docs/unsupported_media_type.html
    ErrorDocument 501 /error_docs/not_implemented.html
    ErrorDocument 502 /error_docs/bad_gateway.html
    ErrorDocument 503 /error_docs/maintenance.html

    <IfModule mod_security2.c>
    </IfModule>

</VirtualHost>
 
Hi Joe_Knighting,

I am a bit surprised, that you investigate your issue without any logs, which normally point to issues and failures. Instead you try to investigate your issue, by using wget and curl and don't even mention, what the output of ( for example! ) "wkhtmltopdf http://YOURDOMAIN.com YOURDOMAIN.pdf" is and if you installed as well "xvfb" in order to have a working "wkhtmltopdf" installation.
 
Back
Top