Tag: plesk

  • Plesk Backup

    Plesk Backup

    To bakcup a site using SSH, login to server as user root, run the command

    plesk bin pleskbackup --domains-name example.com --output-file="/root/example.com.zip" -v
    
  • Reset Plesk Administrator Password

    Reset Plesk Administrator Password

    The Plesk Administrator password is a crucial credential that grants access to the Plesk control panel, where you manage your website, domains, databases, and other essential server settings. In this article, we will walk you through the step-by-step process of resetting the lost password.

    To initiate the process of resetting your lost Plesk Administrator password, login to the server using SSH as user root. If you don’t have root SSH, you may use “sudo su” command to become user root.

    Use the following command to reset the Plesk admin password

    plesk bin admin --set-admin-password -passwd 'NEW_PW_HERE'
    

    Or

    plesk bin user -u admin -passwd 'NEW_PW_HERE'
    

    Once password is retested, you can login at

    https://server-hostname-or-ip:8443
    User = admin
    Password = use password you set above.
    

    If you have SSH root access and want to login with out a password, you can use the command

    plesk login
    

    It will generate a special link, that can be used to auto login to plesk with out a password.

    Back to Plesk

  • Cloudflare Show Real IP Address on CentOS Plesk Server

    Cloudflare Show Real IP Address on CentOS Plesk Server

    Cloudflare is a popular Content Delivery Network (CDN) that can greatly improve website performance and security. When using Cloudflare CDN, the server will report Cloudflare server IP as the visitor IP address. This is because when a visitor visit your website, they are visiting cloudflare server. Cloudflare server will fetch web page from your server, serve it to the visitor. So all access to your server is coming from Cloudflare server, not the real visitor. Cloudflare forward real visitor IP addresses in an HTTP Header “CF-Connecting-IP”. To make Apache show real visitor IP addresses, you can use the Apache module remoteip.

    Enable Apache module remoteip in Plesk

    To Enable remoteip module in Plesk login to Plesk as user admin or root. Go to

    Plesk Admin > Tools & Settings
    

    Plesk Apache Settings

    Under “General Settings”, click on “Apache Web Server”

    On the next page, you will see all available Apache modules. To activate remoteip module, select the checkbox left side of remoteip and click the “OK” button.

    Configure remoteip module

    Create file

    vi /etc/httpd/conf.d/remoteip.conf
    

    In the file, Add

    RemoteIPHeader CF-Connecting-IP
    RemoteIPTrustedProxy 173.245.48.0/20
    RemoteIPTrustedProxy 103.21.244.0/22
    RemoteIPTrustedProxy 103.22.200.0/22
    RemoteIPTrustedProxy 103.31.4.0/22
    RemoteIPTrustedProxy 141.101.64.0/18
    RemoteIPTrustedProxy 108.162.192.0/18
    RemoteIPTrustedProxy 190.93.240.0/20
    RemoteIPTrustedProxy 188.114.96.0/20
    RemoteIPTrustedProxy 197.234.240.0/22
    RemoteIPTrustedProxy 198.41.128.0/17
    RemoteIPTrustedProxy 162.158.0.0/15
    RemoteIPTrustedProxy 104.16.0.0/12
    RemoteIPTrustedProxy 172.64.0.0/13
    RemoteIPTrustedProxy 131.0.72.0/22
    RemoteIPTrustedProxy 2400:cb00::/32
    RemoteIPTrustedProxy 2606:4700::/32
    RemoteIPTrustedProxy 2803:f800::/32
    RemoteIPTrustedProxy 2405:b500::/32
    RemoteIPTrustedProxy 2405:8100::/32
    RemoteIPTrustedProxy 2a06:98c0::/29
    RemoteIPTrustedProxy 2c0f:f248::/32
    

    Save and exit the file. Restart Apache web server.

    systemctl restart httpd
    

    Now Apache will see the real IP address of visitors coming from Cloudflare CDN.

    Back to Plesk

  • How to upgrade Plesk on Windows Server?

    How to upgrade Plesk on Windows Server?

    To upgrade Plesk control panel to the latest version on Windows Server, do the following

    1) Log in to Windows Server using RDP.

    2) Start command prompt as user Administrator.

    3) Update Pleks by applying the latest patches to the current version of plesk.

    plesk installer update
    

    In the command prompt.

    4) Upgrade plesk to newer version with the command

    plesk installer upgrade
    

    This will show a list of Plesk versions available, you need to specify release_id, for example

    Upgrade Plesk on Windows Server

    5) In case you get any error related to the extension, remove it and install it again after the upgrade is done. To remove a plugin, use the command

    plesk bin extension --uninstall EXTENSION_NAME_HERE
    

    Plesk Upgrade Errors

    During the upgrade, if you get the following error

    STDERR:Error in cURL request: error setting certificate verify locations:
      CAfile: C:\Plesk\admin\conf\cacert.pem
      CApath: none
    

    Download the file

    http://curl.haxx.se/ca/cacert.pem

    Replace C:\Plesk\admin\conf\cacert.pem with the downloaded file.

  • Plesk Debian 8 General error: 23 Out of resources when opening

    Plesk Debian 8 General error: 23 Out of resources when opening

    On a Debian 8 server with Plesk control panel, on the Plesk login page, I got the following error message

    500 Plesk\Exception\Database
    DB query failed: SQLSTATE[HY000]: General error: 23 Out of resources when opening file '/tmp/#sql_353d_0.MAI' (Errcode: 24 "Too many open files"), query was: DESCRIBE `sessions`
    

    Plesk Out of resources when opening

    This error is due to MySQL open_files_limit value is set low. To verify, run the command

    SHOW VARIABLES LIKE 'open%';
    

    MySQL settings open_files_limit

    You need to increase the limit.

    On Debian 8, edit the file

    vi /etc/mysql/my.cnf
    

    Find

    [mysqld]
    

    Add below

    open_files_limit = 102400
    

    Restart MySQL

    systemctl restart mysql
    

    If you have other version of Operating System, see MariaDB Change Open Files Limit.

    Back to Plesk

  • How to access SSH Terminal in Plesk Server

    How to access SSH Terminal in Plesk Server

    Plesk server has an SSH Terminal feature, that allows you to access the server console and run commands. This is useful when the firewall blocks the SSH port or you only have the Plesk admin password.

    Login to Plesk Control Panel as user root or admin.

    On the sidebar, click on “Tools and Settings”.

    Plesk Tools and settings

    Click on “SSH Terminal” link, you will be logged in as SSH user root.

    Plesk SSH terminal

    See Plesk

  • Plesk Error: There is no IP address X in the pool

    Plesk Error: There is no IP address X in the pool

    After a Plesk server crash, I migrated files over to a new server. When I log in to Plesk and click any domain name, I get the following error

    Error: There is no IP address 82.165.179.137 in the pool.
    

    plesk no IP address in the pool

    The error is fixed by running the command

    plesk bin subscription -u DOMAIN_HERE -ip 82.165.179.137
    
  • Cloudflare Restoring Visitor IP in Ubuntu Plesk Apache Server

    Cloudflare Restoring Visitor IP in Ubuntu Plesk Apache Server

    When using Cloudflare CDN, visitors come to the Cloudflare server and Cloudflare fetches pages from your server and sent to the visitor. Your server only sees Cloudflare’s IP address. To fix this, we can use the Apache module remoteip.

    On Ubuntu (or Debian) server running Plesk control panel with Apache webserver (no Nginx) do the following to restore real visitor IP address when using Cloudflare CDN.

    Enable mod_remoteip

    a2enmod remoteip

    Create file

    vi /etc/apache2/conf-enabled/remoteip.conf

    Add the following to the file

    RemoteIPHeader CF-Connecting-IP
    RemoteIPTrustedProxy 173.245.48.0/20
    RemoteIPTrustedProxy 103.21.244.0/22
    RemoteIPTrustedProxy 103.22.200.0/22
    RemoteIPTrustedProxy 103.31.4.0/22
    RemoteIPTrustedProxy 141.101.64.0/18
    RemoteIPTrustedProxy 108.162.192.0/18
    RemoteIPTrustedProxy 190.93.240.0/20
    RemoteIPTrustedProxy 188.114.96.0/20
    RemoteIPTrustedProxy 197.234.240.0/22
    RemoteIPTrustedProxy 198.41.128.0/17
    RemoteIPTrustedProxy 162.158.0.0/15
    RemoteIPTrustedProxy 104.16.0.0/12
    RemoteIPTrustedProxy 172.64.0.0/13
    RemoteIPTrustedProxy 131.0.72.0/22
    RemoteIPTrustedProxy 2400:cb00::/32
    RemoteIPTrustedProxy 2606:4700::/32
    RemoteIPTrustedProxy 2803:f800::/32
    RemoteIPTrustedProxy 2405:b500::/32
    RemoteIPTrustedProxy 2405:8100::/32
    RemoteIPTrustedProxy 2a06:98c0::/29
    RemoteIPTrustedProxy 2c0f:f248::/32

    Restart Apache

    systemctl restart apache2

    Now the site will show real visitor IP. You can verify with phpinfo() page, and search for RMOTE_ADDR to see real visitor IP.

    Back to Cloudflare

  • Disable open_basedir in plesk server

    Disable open_basedir in plesk server

    open_basedir is a PHP security feature. With open_basedir enabled, your web application can only access files within specifically allowed folders. If your application tries to access files from a folder that is not allowed, the application fails with an error message.

    To disable open_basedir in Plesk do the following.

    1. Login to your Plesk Control Panel.
    2. From the left menu click on Websites & Domains.
    3. Find the domain name for which you need to disable PHP open_basedir
    4. Click on the domain name to expand.
    5. Click on PHP Settings.
    6. On PHP Settings page, find open_basedir. From the drop down select None.

    Method 2

    To do this in the command line, do the following

    create a file vhost.conf in conf folder of the site.

    vi /var/www/vhosts/yourdomain.extn/conf/vhost.conf
    

    Add the following and save the file.

    
    php_admin_flag engine on
    php_admin_value open_basedir none
    
    

    Now run

    /usr/local/psa/admin/bin/httpdmng --reconfigure-domain yourdomain.com
    

    This will disable open_basedir.

    See Plesk

  • Remove a Plesk Extension from command line

    To list all plesk extension, run

    plesk bin extension --list
    

    To remove a Plesk extension, run

    plesk bin extension --uninstall EXTENSION_NAME
    

    Plesk remove extension

    See Plesk

  • Nginx upstream sent too big header

    Nginx upstream sent too big header

    When I log in to a PrestaShop website, I get an error on a Plesk server.

    502 Bad Gateway
    

    On checking error login for the site in folder /var/www/vhosts/domain.com/logs/proxy_error_log, I found the following error message

    proxy_error_log:2020/11/25 19:41:41 [error] 1809#0: *39664 upstream sent too big header while reading response header from upstream, client: 59.92.71.53, server: tulivesi.com, request: “POST /en/login?back=my-account HTTP/2.0”, upstream: “https://shop.serverok.in:7081/en/login?back=my-account”, host: “shop.serverok.in”, referrer: “https://shop.serverok.in/en/login?back=my-account”

    To fix, add the following to Nginx config.

    If Nginx works as a reverse proxy to another application server.

    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;
    

    If Nginx serve pages using FastCGI/fpm.

    fastcgi_buffers 16 16k; 
    fastcgi_buffer_size 32k;
    

    On Plesk Server

    On Plesk, go to the domain name, then click “Apache & nginx Settings”. On next page add the following code and click OK.

    proxy_buffer_size          128k;
    proxy_buffers              4 256k;
    proxy_busy_buffers_size    256k;
    

    Plesk Nginx

    See Nginx

  • Plesk Mail not working amavis error

    Plesk Mail not working amavis error

    When sending email from a Plesk server, i get error

    Aug 11 19:49:28 vmi274961 postfix/smtp[29276]: E413C3320265: to=, relay=none, delay=0.47, delays=0.47/0/0/0, dsn=4.4.1, status=deferred (connect to 127.0.0.1[127.0.0.1]:10024: Connection refused)
    

    This is beccause amavis service is not running. It is supposed to be run in port 10024

    amavisd error

    When i try to start amavis service, i get error

    Aug 17 09:31:04 server.ishiply.com systemd[1]: Starting LSB: Starts amavisd-new mailfilter...
    Aug 17 09:31:05 server.ishiply.com amavis[7771]: Starting amavisd: Problem in Amavis SQL base code: Can't locate DBI.pm in @INC (you may need to install the DBI module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at (eval 100) line 19.
    Aug 17 09:31:05 server.ishiply.com amavis[7771]: BEGIN failed--compilation aborted at (eval 100) line 19.
    Aug 17 09:31:05 server.ishiply.com amavis[7771]: (failed).
    

    This is becuase Perl DBI module was missing. On Ubuntu server, i found the package that provide this DBI.pm with command “apt-cache search DBI.pm”. To fix the error, install package libdbd-mysql-perl.

    apt install -y libdbd-mysql-perl
    

    After installing this, i try start amavis again. I got differnt error

    root@server:~# systemctl status amavis.service
    ● amavis.service - LSB: Starts amavisd-new mailfilter
       Loaded: loaded (/etc/init.d/amavis; bad; vendor preset: enabled)
       Active: failed (Result: exit-code) since Mon 2020-08-17 09:59:37 SAST; 5s ago
         Docs: man:systemd-sysv-generator(8)
      Process: 10597 ExecStart=/etc/init.d/amavis start (code=exited, status=1/FAILURE)
    
    Aug 17 09:59:36 server.ishiply.com systemd[1]: Starting LSB: Starts amavisd-new mailfilter...
    Aug 17 09:59:37 server.ishiply.com amavis[10603]: starting. /usr/sbin/amavisd-new at server.ishiply.com amavisd-new-2.10.1 (20141025), Unicode aware, LC_ALL="C", LANG="en_US.UTF-8"
    Aug 17 09:59:37 server.ishiply.com amavis[10597]: Starting amavisd: ERROR: MISSING REQUIRED ADDITIONAL MODULES:
    Aug 17 09:59:37 server.ishiply.com amavis[10597]:   DBD::mysql
    Aug 17 09:59:37 server.ishiply.com amavis[10597]:   DBD::mysql
    Aug 17 09:59:37 server.ishiply.com amavis[10597]: (failed).
    Aug 17 09:59:37 server.ishiply.com systemd[1]: amavis.service: Control process exited, code=exited status=1
    Aug 17 09:59:37 server.ishiply.com systemd[1]: Failed to start LSB: Starts amavisd-new mailfilter.
    Aug 17 09:59:37 server.ishiply.com systemd[1]: amavis.service: Unit entered failed state.
    Aug 17 09:59:37 server.ishiply.com systemd[1]: amavis.service: Failed with result 'exit-code'.
    root@server:~# 
    

    To find package that provide DBD::mysql, i used command

    apt-cache search DBD::mysql
    

    To fix, install the package

    apt install -y libdbd-mysql-perl
    

    I am able to start amavis service with command

    systemctl start amavis.service
    

    In Plesk > Extensions > Plesk Email Security now shows Amavis, Postfix and Dovecot running properly.

    Plesk Mail Security Extension