New website throwing 500 error
Hi there. I wrote a new website using Xampp on my Windows machine at home and am now trying to transfer all the code to Linode. I installed a one-click LAMP app on my Linode. My site also uses the CodeIgniter framework.
Details
The site is called mnminimarket.com. I bought the domain recently and it is hosted through GoDaddy.
Code is stored on my Linode in the var/www/html/mnminimarket.com/public_hmtl
folder.
Linode is running Debian GNU/Linux 9 (stretch)
cURL
Contents from running curl -vIl mnminimarket.com
:
* Rebuilt URL to: mnminimarket.com/
* Trying 2600:3c00::f03c:92ff:fedf:b059...
* TCP_NODELAY set
* Connected to mnminimarket.com (2600:3c00::f03c:92ff:fedf:b059) port 80 (#0)
> HEAD / HTTP/1.1
> Host: mnminimarket.com
> User-Agent: curl/7.52.1
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 500 Internal Server Error
HTTP/1.0 500 Internal Server Error
< Date: Sun, 29 Dec 2019 20:45:26 GMT
Date: Sun, 29 Dec 2019 20:45:26 GMT
< Server: Apache/2.4.25 (Debian)
Server: Apache/2.4.25 (Debian)
< Connection: close
Connection: close
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
<
* Curl_http_done: called premature == 0
* Closing connection 0
Error log
The only output in the Apache error log (tail -n 30 /var/log/apache2/error.log
)
[Sun Dec 29 14:24:26.792645 2019] [watchdog:debug] [pid 15582] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.791377 2019] [mpm_prefork:info] [pid 15568] AH00162: server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 19 idle, and 19 total children
[Sun Dec 29 14:24:27.799206 2019] [watchdog:debug] [pid 15594] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.799494 2019] [watchdog:debug] [pid 15593] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.799747 2019] [watchdog:debug] [pid 15595] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.799978 2019] [watchdog:debug] [pid 15592] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.800215 2019] [watchdog:debug] [pid 15596] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.800440 2019] [watchdog:debug] [pid 15597] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.800668 2019] [watchdog:debug] [pid 15598] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.800875 2019] [watchdog:debug] [pid 15599] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.801138 2019] [watchdog:debug] [pid 15591] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.801369 2019] [watchdog:debug] [pid 15600] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.801605 2019] [watchdog:debug] [pid 15601] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.801830 2019] [watchdog:debug] [pid 15590] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.804421 2019] [watchdog:debug] [pid 15602] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.804668 2019] [watchdog:debug] [pid 15604] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.804868 2019] [watchdog:debug] [pid 15603] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
[Sun Dec 29 14:24:27.805055 2019] [watchdog:debug] [pid 15605] mod_watchdog.c(563): AH02980: Watchdog: nothing configured?
(Do I need to install watchdog?)
Apache Config
Output from running apache2ctl -t
:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
Syntax OK
Output from running apache2ctl -S
:
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 is a NameVirtualHost
default server mnminimarket.com (/etc/apache2/sites-enabled/mnminimarket.com.conf:1)
port 80 namevhost mnminimarket.com (/etc/apache2/sites-enabled/mnminimarket.com.conf:1)
alias www.mnminimarket.com
port 80 namevhost mnminimarket.com (/etc/apache2/sites-enabled/mnminimarket.com.conf:1)
alias www.mnminimarket.com
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex rewrite-map: using_defaults
Mutex default: dir="/var/run/apache2/" mechanism=default
Mutex mpm-accept: using_defaults
Mutex watchdog-callback: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
What I've done already…
I ran sudo chown -hR www-data:www-data /var/www/html/mnminimarket.com
to attempt to fix what I thought was an Apache permissions error. No change in results.
I have an .htaccess file that came with CodeIgniter that looks like this, but I'm not sure it's being loaded correctly.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index.php|resources|robots.txt)
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
RewriteCond %{HTTP_HOST} ^mnminimarket\.com$
RewriteRule ^$ index.php/Homepage [L]
Anyway, hopefully this is enough information to give me a few pointers. Thanks much!
1 Reply
These errors can sometimes be a bit difficult to track down as a 500 Error simply refers to an internal server error. This means the issue could lie with Apache, or another process further down the stack. Since this is a LAMP server we'd be looking at MySQL and PHP as well.
The Apache output you've provided seems pretty benign and the only thing that really sticks out to me is:
[mpm_prefork:info] [pid 15568] AH00162: server seems busy, (you may need to increase StartServers, or Min/MaxSpareServers), spawning 16 children, there are 19 idle, and 19 total children
As a first step, you might want to increase the maximum StartServers, Min and Max SpareServers. This config should be found in your /etc/apache2/mods-available/mpm_prefork.conf
file. If you've used our LAMP guide you can probably double all the values. Which wold look something like this:
<IfModule mpm_prefork_module>
StartServers 8
MinSpareServers 40
MaxSpareServers 80
MaxRequestWorkers 400
MaxConnectionsPerChild 4500
</IfModule>
It's also possible that a misconfiguration in PHP is causing this error. This possiblity is discussed here.
I would suggest taking a look at the other applications in the stack. It may be best to start with PHP-FPM: systemctl status php-fpm
And you can run much the same command to check on the status of MySQL: systemctl status mysql
As a general reference, this link might be helpful as memory issues are a common suspect with failing services.