Nginx prompt: 500 Internal Server Error

Source: Internet
Author: User

1. Hard disk space is full

Use df-k to check whether the disk space is full. Clear the hard disk space to solve the 500 error. If access log is enabled for nginx, you are advised to disable access log when you do not need it. Access log occupies a large amount of hard disk space.

2. nginx configuration file error

This does not mean a syntax error. If the configuration file of nginx has a syntax error, a prompt will be displayed at startup. When configuring rewrite, some rules may encounter a 500 error if they are improperly handled. Check your rewrite rules carefully. If some variables in the configuration file are improperly set, a 500 error occurs, for example, a variable without a value is referenced.

3. If none of the above problems exist, it may be that the number of concurrent threads in the simulation is too large. You need to adjust the number of concurrent settings in nginx. conf.

Solution:

1 Open the/etc/security/limits. conf file and add two

The code is as follows: Copy code

* Soft nofile 65535
* Hard nofile 65535

2 Open/etc/nginx. conf
Add a row under worker_processes

The code is as follows: Copy code
Worker_rlimit_nofile 65535;

3. Restart nginx and reload the settings.

The code is as follows: Copy code
Kill-9 'PS-ef | grep php | grep-v grep | awk' {print $2 }''
/Usr/bin/spawn-fcgi-a 127.0.0.1-p 9000-C 100-u www-data-f/usr/bin/php-cgi
Killall-HUP nginx

After restart, check the nginx error log again. No error 500 is reported.


4. There may be a database problem. I did not find any problems in the nginx log php log. I finally found that the database could not be accessed. The problem was solved after the modification.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.