Monday, October 13, 2014

Solve Common NGINX Issue

Fist of all, I write this article to collect all the ways which I used for solved most common Nginx problems during VPS / Server setup process. That mean this post will continuing update until I move to another web server softwares for example: lighttpd, litespeed, ...

If you’re new or old to Nginx, you’ll facing with some problems, some of them can be solve easy with simple steps but we spend a lot time to research and fix it. Why? Did you know? The most frequent issue we see happens when someone attempts to just copy and paste a configuration snippet from some other guide. It’s the answer. Don’t follow the guides out there unless you can understand what they’re trying to do and can clean it up. You’ll solving almost common problems of Nginx.


Your Issue Isn’t Listed!


Yes, this post is not NGINX Problems Dictionary, you can’t find all at here. But don’t be shy, let’s commenting about your problem, maybe it’s can be solve soon with my knowledge or our audience.


HOW TO Solve Common NGINX Problems


400 Bad Request – Request Header Or Cookie Too Large


That’s strange error, someone thinks it’s browser error because restart your browser fixes this issue. If you face this error screen too frequently, your Nginx configuration has problem.


How to fix it


Try increasing the large_client_header_buffers directive in nginx





server 
...
large_client_header_buffers 4 16k;
...


403 Forbidden


Ahh, it’s very common error. Everybody has confused with this and how to fixed it. I’ve mentioned about 403 Forbidden on WordPress before, let’s read it before read on, maybe it’s help you fix this issue.


How to fix it


403 response headers are intentionally returned in many cases such as:


  • Nginx hasn’t permission to read / write to your website files

  • User tries to access a directory but autoindex is set to off.

Turn on autoindex




location /path/to/website/folder 
...
autoindex on;
...


Set folder and files permission correctly or change owner of them

In Ubuntu, the default group and user for web server is www-data, re-check it and set it correctly. Before change it, you can find the information of nginx process:





$ ps -ef | grep nginx
www-data 14132 14130 0 16:06 ? 00:00:00 nginx: worker process


On Arch Linux, it’s http:http


Blog, Solve Common NGINX IssueBlog, Blogging Tips
Solve Common NGINX Issue

0 comments:

Post a Comment