Bang hộiTiền mặt: 0 Xu Trò chơiHộp quà giáng sinhThứ Sáu, 13:21:24 - 26/04/2024
Chia sẻ kiến thức sử dụng VPS (máy chủ ảo) - Server (máy chủ riêng)

Các điều hành viên: Mod, SMod, Admin

[NGINX] 504 Gateway Time-out - Increasing timeout nginx

[NGINX] 504 Gateway Time-out - Increasing timeout nginx

#1 » Gửi bài gửi bởi nghiatichxanh1992 » 14/03/2016 23:54 » @437912

[NGINX] 504 Gateway Time-out - Increasing timeout nginx

It is very common to see a 504 Gateway Time-out using Nginx webserver. This timeout error is generated often by a number of reasons on the backend connection that is serving content. To fix it, you will have to figure out what configuration are you using.


For Nginx + FastCGI (php-fpm), you should try to tweak nginx configuration in this way-:

Try raising max_execution_time setting in php.ini file (CentOS path is /etc/php.ini):
Mã: Chọn tất cả
max_execution_time = 300


But, you should also change set request_terminate_timeout parameter (commented by default) at http://www.conf file from PHP-FPM:
Mã: Chọn tất cả
pico -w /etc/php-fpm.d/www.conf


Then set the variable to the same value as max_execution_time:
Mã: Chọn tất cả
request_terminate_timeout = 300


Now let’s add fastcgi_read_timeout variable inside our Nginx virtual host configuration:
Mã: Chọn tất cả
location ~ .php$ {
root /var/www/sites/nginxtips.com;
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 300;
}



Then restart nginx:
Mã: Chọn tất cả
service nginx restart


For Nginx as Proxy for Apache web server, this is what you have to try:

Add this variables to nginx.conf file:
Mã: Chọn tất cả
proxy_connect_timeout       600;
 proxy_send_timeout          600;
 proxy_read_timeout          600;
 send_timeout                600;


Then restart nginx:
Mã: Chọn tất cả
service nginx restart
nghiatichxanh1992 ✅
Hình đại diện của thành viên
Rank: ☀️2/30☀️
Cấp độ:
Tu luyện:
Like:
Online:
Bang hội: Tiếu Ngạo
Xếp hạng Bang hội: ⚡5/60⚡
Level:
Chủ đề đã tạo: 🩸4140/4140🩸
Tiền mặt:
Ngân hàng:
Nhóm:
Danh hiệu: ⚝Truyền Thuyết⚝
Giới tính:
Ngày tham gia:
Đến từ:
Thiết bị:
Số điện thoại:
(Cốc Cốc 54.2.131)


Quay về VPS - Server

 


  • Chủ đề tương tự
    Trả lời
    Xem
    Bài viết mới nhất