Skip to content

Service Management Commands ​

This page covers services installed by aaPanel. Same-named services installed with apt, yum, or dnf may conflict with them.

Run the commands as root. Check the service status and logs before restarting or changing configuration.

Quick diagnosis ​

SymptomCheck first
Panel itself is unreachableSee Panel health check.
Service is not runningRun its status command, then read the error log.
A port is already in useFind the process using the port before restarting. See Nginx port conflict.
A configuration change causes an errorRun the configuration test before reloading or restarting.
Service stops again after a restartRead the error log, then check disk space, permissions, and the configuration file.

Nginx Service ​

Nginx, OpenResty, and Tengine installed from aaPanel use the following paths and commands.

ItemPath or command
Website configuration directory/www/server/panel/vhost/nginx
Main configuration directory/www/server/nginx/conf/
Main configuration file/www/server/nginx/conf/nginx.conf
Program directory/www/server/nginx
Start command/etc/init.d/nginx start
Stop command/etc/init.d/nginx stop
Reload command/etc/init.d/nginx reload
Restart command/etc/init.d/nginx restart
Status command/etc/init.d/nginx status
Configuration test/etc/init.d/nginx configtest
Access log/www/wwwlogs/access.log
Error log/www/wwwlogs/nginx_error.log

Nginx logs ​

bash
tail -n 100 /www/wwwlogs/nginx_error.log

Nginx Problems and Solutions ​

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

Nginx port 80 already in use

  1. Log in over SSH as root and find the process using port 80:

    bash
    netstat -tulnp | grep -w 80
    ps aux | grep nginx

    Process using port 80

    To inspect a specific process ID, run ps aux | grep <PID>.

  2. Check the process path. The Nginx installed by aaPanel is /www/server/nginx/sbin/nginx.

    If the path is /usr/sbin/nginx, Nginx was installed as a system package:

    bash
    systemctl stop nginx
    systemctl disable nginx

    System and panel Nginx processesSystem Nginx executable path

  3. Start the Nginx installed by aaPanel:

    bash
    /etc/init.d/nginx start

/www/server/panel/webserver/sbin/webserver belongs to aaPanel and is not a website Nginx process. Ignore it when troubleshooting port 80.

MySQL / MariaDB Service ​

ItemPath or command
Data directory/www/server/data
MySQL program directory/www/server/mysql
Configuration file/etc/my.cnf
Start command/etc/init.d/mysqld start
Stop command/etc/init.d/mysqld stop
Restart command/etc/init.d/mysqld restart
Reload command/etc/init.d/mysqld reload
Status command/etc/init.d/mysqld status
Error log/www/server/data/*.err

Do not install MySQL or MariaDB with apt, yum, or dnf. Use the version installed by aaPanel to avoid database and socket conflicts.

View MySQL error log ​

  1. Open Databases > MySQL, click MySQL <version> at the top of the page, then select Error log.

    MySQL error log

  2. Over SSH, view the latest errors:

    bash
    grep -i -C 10 error /www/server/data/*.err | tail -n 200

If you changed the MySQL data directory, replace /www/server/data with the actual path in both commands.

Use tail instead of cat for a log that is still being written.

Quick check ​

Run this command as root:

bash
curl -k https://www.aapanel.com/script/mysql_check.sh | bash

The script checks the installation source, process state, version, data directory, and port. If MySQL is not running, it prints the error log. It does not repair MySQL or modify data.

Common MySQL issues ​

SymptomCheck
MySQL does not startRun /etc/init.d/mysqld status, read the error log, and check disk space, data-directory permissions, and /etc/my.cnf. See MySQL startup failure.
2002 or 2003: Cannot connectConfirm that MySQL is running, then check the socket, host, and port used by the site. See Cannot connect to MySQL.
1049: Unknown databaseConfirm the database name and letter case, then restore the database if it no longer exists. See Unknown database.
InnoDB storage engine damageStop database writes, take a snapshot or back up the data directory, then follow the InnoDB recovery guide.

For other database issues, see Databases Related.

PHP ​

PHP versions use two digits in service names. PHP 8.2 is 82; replace it with the version used by your site.

ItemPath or command
Main configuration directory/www/server/php/82/etc/
Program directory/www/server/php/82/
Start command/etc/init.d/php-fpm-82 start
Stop command/etc/init.d/php-fpm-82 stop
Reload command/etc/init.d/php-fpm-82 reload
Restart command/etc/init.d/php-fpm-82 restart
Status command/etc/init.d/php-fpm-82 status
Configuration test/etc/init.d/php-fpm-82 configtest
Error log/www/server/php/82/var/log/php-fpm.log

Do not install PHP with apt, yum, or dnf. Use the PHP version installed by aaPanel.

PHP logs ​

bash
tail -n 100 /www/server/php/82/var/log/php-fpm.log

To confirm which PHP version a site uses, open the site in aaPanel and check its PHP version setting.

PHP Problems and Solutions ​

PHP-FPM socket already in use ​

failed to activate: unable to bind listening socket for address '/tmp/php-cgi-84.sock': Address already in use (98)

PHP-FPM socket already in use

  1. Open Files and go to /tmp/.
  2. Find php-cgi-84.sock and replace 84 with the PHP version in the error message.
  3. Confirm that no healthy PHP-FPM process is using the socket, then delete it.
  4. Restart PHP-FPM for that version.

Delete the PHP-FPM socket

Install PHP extensions ​

  1. Open App Store > Installed > PHP <version> and install common extensions from the extension list.

    PHP extensions

  2. If an extension is not listed, compile and install it.

ionCube example ​

  1. Download the loader for your operating-system architecture from ionCube Loaders.

  2. Extract the package and find the loader for your PHP version, for example ioncube_loader_lin_8.3.so.

  3. Place it in /usr/local/ioncube/.

  4. Add the loader to the PHP configuration file and restart PHP:

    ini
    zend_extension = /usr/local/ioncube/ioncube_loader_lin_8.3.so

    ionCube loader configuration

tidy example ​

The following example installs the tidy extension for PHP 7.4. Replace php_version=74 with your PHP version.

  1. Install the system libraries.

    CentOS:

    bash
    dnf install libtidy libtidy-devel

    Ubuntu or Debian:

    bash
    apt install libtidy-dev
  2. Download and extract the extension source:

    bash
    wget https://pecl.php.net/get/tidy-1.2.tgz
    tar xvf tidy-1.2.tgz
    cd tidy-1.2
  3. Compile and install it:

    bash
    php_version=74
    /www/server/php/${php_version}/bin/phpize
    ./configure --with-php-config=/www/server/php/${php_version}/bin/php-config
    make
    make install
    extFile="tidy.so"
    echo "extension = ${extFile}" >> /www/server/php/${php_version}/etc/php.ini
    echo "extension = ${extFile}" >> /www/server/php/${php_version}/etc/php-cli.ini
    /etc/init.d/php-fpm-${php_version} reload

fileinfo ​

  1. Install fileinfo from App Store > Installed > PHP <version>.

    fileinfo extension

  2. If the extension is installed but is still reported as missing, the PHP build may have been compiled with --disable-fileinfo to reduce memory use.

  3. Take a snapshot first, then rebuild the PHP version with fileinfo enabled. Replace 8.2 with the version used by the site:

    bash
    wget -O php.sh https://node.aapanel.com/install/0/php.sh
    sed -i 's/--disable-fileinfo/--enable-fileinfo/g' php.sh
    bash php.sh install 8.2

Enable shell_exec or putenv ​

These functions are disabled by default for security. Enable them only when the application requires them and you trust its code.

  1. Open App Store > Installed > PHP <version> > Disabled functions.
  2. Remove shell_exec or putenv, save the change, and restart PHP.
  3. Alternatively, remove the function from disable_functions in php.ini and restart PHP.

Redis ​

ItemPath or command
Configuration file/www/server/redis/redis.conf
Program directory/www/server/redis
Start command/etc/init.d/redis start
Stop command/etc/init.d/redis stop
Reload command/etc/init.d/redis reload
Restart command/etc/init.d/redis restart
Status command/etc/init.d/redis status
Log file/www/server/redis/redis.log

Redis logs ​

bash
tail -n 100 /www/server/redis/redis.log

Apache ​

ItemPath or command
Website configuration directory/www/server/panel/vhost/apache
Main configuration directory/www/server/apache/conf/
Program directory/www/server/apache
Start command/etc/init.d/httpd start
Stop command/etc/init.d/httpd stop
Reload command/etc/init.d/httpd reload
Restart command/etc/init.d/httpd restart
Status command/etc/init.d/httpd status
Configuration test/etc/init.d/httpd configtest
Access log/www/wwwlogs/access_log
Error log/www/wwwlogs/error_log

Apache logs ​

bash
tail -n 100 /www/wwwlogs/error_log

OpenLiteSpeed ​

OpenLiteSpeed uses lsphp by default, not PHP-FPM.

ItemPath or command
Website configuration directory/www/server/panel/vhost/openlitespeed
Main configuration directory/usr/local/lsws/conf/
Program directory/usr/local/lsws
Start command/usr/local/lsws/bin/lswsctrl start
Stop command/usr/local/lsws/bin/lswsctrl stop
Reload command/usr/local/lsws/bin/lswsctrl reload
Restart command/usr/local/lsws/bin/lswsctrl restart
Status command/usr/local/lsws/bin/lswsctrl status
Access log/usr/local/lsws/logs/access.log
Error log/usr/local/lsws/logs/error.log

OpenLiteSpeed logs ​

bash
tail -n 100 /usr/local/lsws/logs/error.log

lsphp ​

lsphp is the PHP package used by OpenLiteSpeed. It has no separate PHP-FPM service; OpenLiteSpeed starts its LSAPI workers.

The following example uses PHP 7.4. Replace 74 with 73, 80, 81, 82, and so on for other versions.

ItemPath
Program directory/usr/local/lsws/lsphp74/
Main configuration directory/usr/local/lsws/lsphp74/etc/
PHP binary/usr/local/lsws/lsphp74/bin/php

To apply configuration changes, restart OpenLiteSpeed:

bash
/usr/local/lsws/bin/lswsctrl restart

Common mistakes ​

MistakeBetter approach
Using cat to read a log that is still growingUse tail -n 100 <log-file>.
Restarting repeatedly without checking the causeRun the status command and read the error log first.
Mixing a system service with the aaPanel serviceStop the system service and install the aaPanel version.
Deleting data or log files while troubleshootingTake a snapshot or back up the data first. Do not delete the MySQL data directory.

Feedback or Suggestions ​

If you encounter problems or suggestions during use, please contact us through the following methods:

  • (Please describe in detail or provide screenshots)
  1. Email: [email protected]

  2. Forum: https://www.aapanel.com/forum

  3. Discord: https://discord.gg/Tya5yceBpd

  4. Telegram: https://aapanel.com/tg

  5. GitHub: https://github.com/aapanel/aapanel

    If you like aaPanel, please give it a Star