Category: Plesk

  • Plesk MySQL upgrade 5.1 to 5.5

    When trying to restore a database backup taken on MariaDB 5.5.56 on a Plesk server running MySQL 5.1, i get error

    [root@xap ~]# mysql admin_dollsweb < admin_dollsweb.sql ERROR 1273 (HY000) at line 25: Unknown collation: 'utf8mb4_unicode_ci' [root@xap ~]#

    This is because MySQL 5.1 do not support utf8mb4_unicode_ci.

    Solution 1

    You can find and replace utf8mb4_unicode_ci with utf8_general_ci

    sed -i 's/utf8mb4_unicode_ci/utf8_general_ci/g' DB_BACKUP.sql
    

    One problem with this is you may lose some characters if the DB use the new charsets supported by utf8mb4_unicode_ci. utf8mb4_unicode_ci For most sites these won’t be a problem. utf8mb4_unicode_ci support latest emoji chars.

    Solution 2

    Upgrade MySQL to version 5.5 or newer.

    On Plesk server, do the following steps

    wget -q -O - http://www.atomicorp.com/installers/atomic | sh
    

    When asked, type “yes” to enable the repo.

    Upgrade MySQL with

    yum upgrade mysql
    

    Restart MySQL

    service mysqld restart
    

    Upgrade MySQL database with

    mysql_upgrade -uadmin -p`cat /etc/psa/.psa.shadow`
    
  • Plesk Nginx fail to start on boot

    On a Debian Server with Plesk Control Panel, Nginx did not start on boot.

    On checking status, i get

    root@server:~# systemctl status nginx
    * nginx.service - Startup script for nginx service
       Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
       Active: failed (Result: exit-code) since Mon 2018-01-22 18:30:19 CET; 2min 21s ago
      Process: 700 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
      Process: 646 ExecStartPre=/usr/bin/test $NGINX_ENABLED = yes (code=exited, status=0/SUCCESS)
    
    Jan 22 18:30:19 server.hostonnet.com nginx[700]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    Jan 22 18:30:19 server.hostonnet.com nginx[700]: nginx: [emerg] bind() to 82.211.1.93:80 failed (99: Cannot assign requested address)
    Jan 22 18:30:19 server.hostonnet.com nginx[700]: nginx: configuration file /etc/nginx/nginx.conf test failed
    Jan 22 18:30:19 server.hostonnet.com systemd[1]: nginx.service: control process exited, code=exited status=1
    Jan 22 18:30:19 server.hostonnet.com systemd[1]: Failed to start Startup script for nginx service.
    Jan 22 18:30:19 server.hostonnet.com systemd[1]: Unit nginx.service entered failed state.
    root@server:~# 
    

    /var/log/nginx/error_log had following error

    2018/01/22 18:30:19 [emerg] 700#0: bind() to 82.211.1.93:80 failed (99: Cannot assign requested address)

    Solution

    Edit nginx.service file

    vi /etc/systemd/system/multi-user.target.wants/nginx.service
    

    Find line

    ExecStartPre
    

    Add above (on a new line)

    ExecStartPre=/bin/sleep 60
    

    Find

    After=network.target remote-fs.target nss-lookup.target
    

    Replace with

    After=network-online.target remote-fs.target nss-lookup.target
    

    Reload service file

    systemctl daemon-reload
    

    Here is my modified nginx.service file

    root@root1229:~# cat /lib/systemd/system/nginx.service
    [Unit]
    Description=Startup script for nginx service
    After=network-online.target remote-fs.target nss-lookup.target
    
    [Service]
    Type=forking
    PIDFile=/run/nginx.pid
    EnvironmentFile=-/etc/default/nginx
    
    .include /etc/default/nginx.systemd
    # tuning of limits settings:
    # 1. fill required limits as described in systemd.exec(5)
    # 	nginx.systemd content example for number of open files:
    # 	[Service]
    # 	LimitNOFILE=8192
    # 2. restart service
    
    ExecStartPre=/bin/sleep 60
    ExecStartPre=/usr/bin/test $NGINX_ENABLED = "yes"
    ExecStartPre=/usr/sbin/nginx -t
    ExecStart=/usr/sbin/nginx
    
    ExecReload=/usr/bin/test $NGINX_ENABLED = "yes"
    ExecReload=/usr/sbin/nginx -t
    ExecReload=/bin/kill -s HUP $MAINPID
    
    ExecStop=/bin/kill -s QUIT $MAINPID
    
    [Install]
    WantedBy=multi-user.target
    root@root1229:~# 
    

    plesk