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

Detailed explanation of as, question mark and exclamation mark in Typescript

1. The as keyword indicates an assertion In Types...

Full analysis of Vue diff algorithm

Table of contents Preface Vue update view patch s...

How to create a table in mysql and add field comments

Directly post code and examples #Write comments w...

Troubleshooting the reasons why MySQL deleted records do not take effect

A record of an online MySQL transaction problem L...

How to install Nginx in a specified location in Centos system

How to install Nginx in a specified location in C...

CSS3 to achieve menu hover effect

Result: html <nav id="nav-1"> <...

How to solve the error of PyCurl under Linux

Solution to "Could not run curl-config"...

Detailed explanation of common usage of MySQL query conditions

This article uses examples to illustrate the comm...

Native js drag and drop function to create a slider example code

Drag and drop is a common function in the front e...

Use Navicate to connect to MySQL on Alibaba Cloud Server

1. First enter the server's mysql to modify p...

How to install and configure GitLab on Ubuntu 20.04

introduce GitLab CE or Community Edition is an op...

How to deploy SpringBoot project using Docker

The development of Docker technology provides a m...