Tried everything, can't solve it. The error shows up at random points in time when client browsers access various PHP scripts, also in my own progran an Exception is sometimes being raised when I tried to pull content from PHP scripts. Sometimes it works well, sometimes doesn't.
Everything worked fine for years until some months ago.
Can a good soul take me slowly through a list of steps debugging? I am a novice in Linux.
htop screenshot shows nothing unusual right now:
1 [| 0.2%] 5 [ 0.0%]
2 [ 0.0%] 6 [ 0.0%]
3 [ 0.0%] 7 [ 0.0%]
4 [|| 0.5%] 8 [|| 0.7%]
Mem[|||||||||||||||||||||||||5363/32087MB] Tasks: 57, 27 thr; 1 running
Swp[|| 632/16375MB] Load average: 0.04 0.07 0.13
Uptime: 57 days, 22:41:20
PID USER PRI NI VIRT RES SHR S CPU% MEM% TIME+ Command
468 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 0:06.91 /usr/sbin/mysqld
3742 root 20 0 26020 2368 1444 R 0.2 0.0 0:00.09 htop
1235 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 104h /usr/sbin/mysqld
3745 root 20 0 101M 3968 2900 S 0.2 0.0 0:00.03 sshd: [accepted]
851 root 20 0 545M 291M 7936 S 0.0 0.9 1:56.57 php /home/***/fr/fetcher.php
1 root 20 0 34032 2188 1084 S 0.0 0.0 0:47.96 /sbin/init
996 syslog 20 0 250M 22444 820 S 0.0 0.1 2:27.11 rsyslogd
1402 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 4:11.39 /usr/sbin/mysqld
430 root 20 0 20004 492 492 S 0.0 0.0 0:00.13 upstart-udev-bridge --daemon
440 root 20 0 51344 712 712 S 0.0 0.0 0:00.03 /lib/systemd/systemd-udevd --dae
608 root 20 0 15260 368 368 S 0.0 0.0 0:00.08 upstart-socket-bridge --daemon
849 root 20 0 59640 1444 1088 S 0.0 0.0 0:00.00 CRON
850 root 20 0 4444 648 548 S 0.0 0.0 0:00.00 /bin/sh -c php /home/***/fr/fe
856 root 20 0 59640 1044 1040 S 0.0 0.0 0:00.00 CRON
858 root 20 0 4444 460 456 S 0.0 0.0 0:00.00 /bin/sh -c php /home/***/updat
860 root 20 0 341M 5676 3580 S 0.0 0.0 1:43.45 php /home/***/updater/index.ph
931 root 20 0 15276 376 376 S 0.0 0.0 0:00.06 upstart-file-bridge --daemon
965 messagebu 20 0 39216 1000 808 S 0.0 0.0 0:00.47 dbus-daemon --system --fork
997 syslog 20 0 250M 22444 820 S 0.0 0.1 0:00.02 rsyslogd
998 syslog 20 0 250M 22444 820 S 0.0 0.1 2:06.88 rsyslogd
995 syslog 20 0 250M 22444 820 S 0.0 0.1 4:34.06 rsyslogd
1014 root 20 0 43452 1408 1232 S 0.0 0.0 0:00.60 /lib/systemd/systemd-logind
1043 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty4
1045 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty5
1054 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty2
1055 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty3
1058 root 20 0 15820 676 672 S 0.0 0.0 0:00.00 /sbin/getty -8 38400 tty6
1074 root 20 0 4368 388 388 S 0.0 0.0 0:00.02 acpid -c /etc/acpi/events -s /va
1160 root 20 0 23656 724 640 S 0.0 0.0 0:14.16 cron
1161 daemon 20 0 19140 172 172 S 0.0 0.0 0:00.03 atd
1313 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.18 /usr/sbin/mysqld
1314 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:35.50 /usr/sbin/mysqld
1315 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.36 /usr/sbin/mysqld
1316 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.77 /usr/sbin/mysqld
1317 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.93 /usr/sbin/mysqld
1318 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.12 /usr/sbin/mysqld
1319 mysql 20 0 8626M 4065M 4896 S 0.0 12.7 2:37.22 /usr/sbin/mysqld
F1Help F2Setup F3SearchF4FilterF5Tree F6SortByF7Nice -F8Nice +F9Kill F10Quit
The contents of /etc/apache2/apache2.conf. There are many other *.conf files in this directory.
Mutex file:${APACHE_LOCK_DIR} default
#
# PidFile: The file in which the server should record its process
# identification number when it starts.
# This needs to be set in /etc/apache2/envvars
#
PidFile ${APACHE_PID_FILE}
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300
#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On
#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100
#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 5
# These need to be set in /etc/apache2/envvars
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
# Include module configuration:
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
# Include of directories ignores editors' and dpkg's backup files,
# see README.Debian for details.
# Include generic snippets of statements
IncludeOptional conf-enabled/*.conf
# Include the virtual host configurations:
IncludeOptional sites-enabled/*.conf
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
# Include phpmyadmin
Include /etc/phpmyadmin/apache.conf
ServerName localhost
<VirtualHost *:80>
ServerAdmin info@***.com
DocumentRoot "/var/www/html"
ServerName ***.***.com
ServerAlias ***.***.com
ErrorLog "logs/***/error_log"
CustomLog "logs/***/access_log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin info@***.com
DocumentRoot "/var/www/***"
ServerName ***.com
ServerAlias www.***.com
ErrorLog "logs/***/error_log"
CustomLog "logs/***/access_log" common
</VirtualHost>
It sounds a little like your server might be running out of resources occasionally and is therefore unable to respond.
An easy way to see if this is the case is to install (
sudo apt-get install htop
) and run a Linux program calledhtop
.It will show you up the top how much CPU and RAM is being used and then list the processes (programs) that are open. You can sort the list by the various columns to see which ones are taking up resources.
Incidentally, it's a good way to check what sort of programs you're using, for instance if you see anything under
command
calledhttpd
or/usr/sbin/httpd
or similar, you know you're using Apache as a web server.And because htop is a read-only program, you can't break anything by using it.
I have good reasons to believe the issue had nothing to do with my server, but with the internet connection I used on my personal laptop to access the server. I connect to the Internet with a mobile Wi-Fi device provided by Vodafone (converts 4G into WiFi). Vodafone servers somehow send this error message even before anything times out on my server. They do so for other servers as well. Other people using different internet connections do not receive the Gateway Timeout error when dealing with my server.