How does CWP7 set the extended timeout limit?Solve Nginx 504 Gateway error

When we are on the CWP7.pro serverWordPressTime,使用WordPress pluginChat GPT AI When Power: Complete AI Pack, the following error message appears"It appears that your web server has some kind of timeout limit., which means that the CWP Gateway did not receive a timely response from the upstream server or application.

How does CWP7 set the extended timeout limit?

CWP7 free version only needs to modify the following 2 settings:

  1. Modify the timeout value of proxy settings
  2. change default_socket_timeout

1. Modify the timeout value of proxy settings

edit /etc/nginx/proxy.inc file, modify the following timeout value to 600 ▼

proxy_connect_timeout 600s;
proxy_send_timeout 600;
proxy_read_timeout 600;

2. Change default_socket_timeout

OnCWP Control PanelClick on the left → PHP Settings → PHP.ini Configuration ▼

How does CWP7 set the extended timeout limit?Solve Nginx 504 Gateway error

or edit /usr/local/php/php.ini file, search"default_socket_timeout", modified to 600 ▼

default_socket_timeout 600

CWP7 Pro professional paid version, you need to modify the configuration file

If you use the paid version of CWP7 Pro, you may also need to change the PHP-FPM configuration:

1. Default location:

/opt/alt/php-fpm72/usr/etc/
/opt/alt/php-fpm72/usr/etc/php-fpm.d/
/opt/alt/php-fpm72/usr/etc/php-fpm.d/users/

2. Add the following values ​​to the cwpsvc.conf file:

# vi /opt/alt/php-fpm72/usr/etc/php-fpm.d/cwpsvc.conf

[cwpsvc]listen = /opt/alt/php-fpm72/usr/var/sockets/cwpsvc.sock
listen.owner = cwpsvc
listen.group = cwpsvc
listen.mode = 0640
user = cwpsvc
group = cwpsvc

;request_slowlog_timeout = 5s
;slowlog = /opt/alt/php-fpm72/usr/var/log/php-fpm-slowlog-cwpsvc.log
listen.allowed_clients = 127.0.0.1

pm = ondemand
pm.max_children = 1000
pm.process_idle_timeout = 300s
;listen.backlog = -1
request_terminate_timeout = 300s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
env[PATH] = /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

3. Add the following value to the nobody.conf file:

# vi /opt/alt/php-fpm72/usr/etc/php-fpm.d/users/nobody.conf

[nobody]listen = /opt/alt/php-fpm72/usr/var/sockets/nobody.sock
listen.allowed_clients = 127.0.0.1

listen.owner = nobody
listen.group = nobody
listen.mode = 0660
user = nobody
group = nobody

;request_slowlog_timeout = 15s
;slowlog = /opt/alt/php-fpm72/usr/var/log/php-fpm-slowlog-nobody.log

pm = ondemand
pm.max_children = 1000
pm.max_requests = 6000
pm.process_idle_timeout = 300s

;listen.backlog = -1
request_terminate_timeout = 300s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /tmp
env[TMPDIR] = /tmp
env[TEMP] = /tmp
env[PATH] = /usr/local/bin:/usr/bin:/bin

4. Change the following content:

# vi /opt/alt/php-fpm72/usr/etc/php-fpm.d/users/datahead.conf

[datahead]listen = /opt/alt/php-fpm72/usr/var/sockets/datahead.sock
listen.allowed_clients = 127.0.0.1

;listen.owner = "datahead"
listen.group = "nobody"
listen.mode = 0660
user = "datahead"
group = "datahead"

;request_slowlog_timeout = 15s
;slowlog = /opt/alt/php-fpm72/usr/var/log/php-fpm-slowlog-datahead.log

pm = ondemand
pm.max_children = 1000
pm.max_requests = 4000
pm.process_idle_timeout = 300s

;listen.backlog = -1
request_terminate_timeout = 300s
rlimit_files = 131072
rlimit_core = unlimited
catch_workers_output = yes

env[HOSTNAME] = $HOSTNAME
env[TMP] = /home/datahead/tmp
env[TMPDIR] = /home/datahead/tmp
env[TEMP] = /home/datahead/tmp
env[PATH] = /usr/local/bin:/usr/bin:/bin
  • NOTE: Only change values ​​that are only marked in blue.

Now let's add fastcgi_read_timeout variable in Nginx virtual host configuration.

If you use PHP-FPM hosting then add (you can use 600s):

# vi /etc/nginx/conf.d/vhosts/datahead.biz.ssl.conf

fastcgi_pass unix:/opt/alt/php-fpm72/usr/var/sockets/datahead.sock;
fastcgi_index index.php;
fastcgi_send_timeout 300s;
fastcgi_read_timeout 300s;
include /etc/nginx/fastcgi_params;

If you use PHP-CGI, then use its nginx.conf file:

# Proxy settings
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
fastcgi_send_timeout 600s;
fastcgi_read_timeout 600s;
proxy_buffers 32 4k;

If you use PHP selector 2:

# sed -i 's,^upload_max_filesize =.*$,upload_max_filesize = 4096M,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^post_max_size =.*$,post_max_size = 4146M,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^memory_limit =.*$,memory_limit = 5120M,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^max_input_time =.*$,max_input_time = 300,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^max_execution_time =.*$,max_execution_time = 300,' /opt/alt/php72/usr/php/php.ini

# sed -i 's,^; max_input_vars =.*$,max_input_vars = 5000,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^max_file_uploads =.*$,max_file_uploads = 50,' /opt/alt/php72/usr/php/php.ini

# sed -i 's,^allow_url_fopen =.*$,allow_url_fopen = On,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^allow_url_include =.*$,allow_url_include = Off,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^short_open_tag =.*$,short_open_tag = Off,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^;date.timezone =.*$,date.timezone = Asia/Dhaka,' /opt/alt/php72/usr/php/php.ini

# sed -i 's,^display_errors =.*$,display_errors = Off,' /opt/alt/php72/usr/php/php.ini
# sed -i 's,^expose_php =.*$,expose_php = Off,' /opt/alt/php72/usr/php/php.ini
  • At this point, the problem should be resolved.

Hope Chen Weiliang Blog ( https://www.chenweiliang.com/ ) Shared "How does CWP7 set to extend the timeout limit?"Solve Nginx 504 Gateway Error", it will help you.

Welcome to share the link of this article:https://www.chenweiliang.com/cwl-30321.html

Welcome to the Telegram channel of Chen Weiliang's blog to get the latest updates!

🔔 Be the first to get the valuable "ChatGPT Content Marketing AI Tool Usage Guide" in the channel top directory! 🌟
📚 This guide contains huge value, 🌟This is a rare opportunity, don’t miss it! ⏰⌛💨
Share and like if you like!
Your sharing and likes are our continuous motivation!

 

Comment

Your email address will not be published. Required fields * Callout

scroll to top