Nginx service 500: Internal Server Error one of the reasons

Nginx service 500: Internal Server Error one of the reasons

500 (Internal Server Error) The server encountered an error and could not complete the request.
501 (Not Implemented) The server does not have the functionality to complete the request. For example, a server might return this code when the server does not recognize the request method.
502 (Bad Gateway) The server, while acting as a gateway or proxy, received an invalid response from an upstream server.
503 (Service Unavailable) The server is currently unavailable (either because it is overloaded or down for maintenance). Usually, this is only a temporary condition.
504 (Gateway Timeout) The server, acting as a gateway or proxy, did not receive a request from an upstream server in a timely manner.
505 (HTTP Version Not Supported) The server does not support the HTTP protocol version used in the request.
Nginx 500 error (Internal Server Error): A 500 error refers to an internal server error, which means that the server encountered an unexpected situation and was unable to fulfill the request.

In the case of high concurrent connections, Nginx is a good alternative to Apache server. Nginx can also be used as a layer 7 load balancing server. According to the test results, Nginx 0.6.31 + PHP 5.2.6 (FastCGI) can handle more than 30,000 concurrent connections, which is 10 times that of Apache under the same environment.

But many people will encounter 500 errors when using Nginx. According to my experience, there are the following situations.

1. Is there insufficient disk space?

Use df -k to check whether the hard disk space is full. Clearing up hard drive space can resolve 500 errors. If nginx has access log enabled, it is best to disable access log if it is not needed. The access log will take up a lot of hard disk space.

2. Is the nginx configuration file wrong?

This does not refer to syntax errors. If there are syntax errors in the nginx configuration file, it will be prompted when it is started. When configuring rewrite, some rules may not be handled properly and a 500 error may occur. Please check your rewrite rules carefully. A 500 error may also occur if some variables in the configuration file are not set correctly, such as referencing a variable that has no value.

3. If none of the above problems exist, it may be that the number of simulated concurrency is too large, and you need to adjust the concurrency setting number of nginx.conf

4. Another problem is that the Linux index node (inode) is full and causes failure. df -i

There could be many reasons, I just record the ones I encountered.

500, internal server error, may actually be an error caused at the code level.

First, check the ngnix or Apache error log, and then check the error log. You can basically find the cause of the error based on the error log, or search the error log on Google or Baidu.

Secondly, you can view the error log information of the framework, such as laravel.log.

sudo find / -name '*.log' 
or 
cd /var/log/nginx/ && ls 

cat /var/log/nginx/newdns.com-error.log 

Summary: The error I encountered this time was because my MySQL table did not have the `updated_at`, `created_at` fields, and was not set in the Laravel framework model

public $timestamps = false; , I wrote the wrong path when rewriting the exception handler Exception, which caused MySQL to throw an error. The framework exception handler could not handle it, so it ran to the server, causing the server to hang. I was devastated.

This is the end of this article about Nginx service 500: Internal Server Error, one of the reasons. For more information about Nginx service 500 error, please search 123WORDPRESS.COM’s previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Detailed explanation of PHP+nginx service 500 502 error troubleshooting ideas

<<:  Data storage implementation method in WeChat applet

>>:  Solve the MySQL login 1045 problem under centos

Recommend

Troubleshooting of master-slave delay issues when upgrading MySQL 5.6 to 5.7

Recently, when upgrading the Zabbix database from...

Front-end advanced teaching you to use javascript storage function

Table of contents Preface Background Implementati...

MySQL 8.0.21 free installation version configuration method graphic tutorial

Six steps to install MySQL (only the installation...

33 ice and snow fonts recommended for download (personal and commercial)

01 Winter Flakes (Individual only) 02 Snowtop Cap...

Example sharing of anchor tag usage in HTML

Anchor tag usage: Linking to a specific location i...

Angular Dependency Injection Explained

Table of contents Overview 1. Dependency Injectio...

Two ways to declare private variables in JavaScript

Preface JavaScript is not like other languages ​​...

In-depth explanation of MySQL user account management and permission management

Preface The MySQL permission table is loaded into...

How to deploy DoNetCore to Alibaba Cloud with Nginx

Basic environment configuration Please purchase t...

Detailed explanation of JavaScript object conversion to primitive value

Table of contents Object.prototype.valueOf() Obje...

Solve the problem that Docker pulls MySQL image too slowly

After half an hour of trying to pull the MySQL im...

Docker installation and deployment of Net Core implementation process analysis

1. Docker installation and settings #Install Cent...