我的服务器经常出现超时问题,我调整了fastcg_read_timeout
和proxy_read_timeout
等参数,但没有解决我的问题。在我的xxxx.conf下面查找
server {
server_name www.xxxx.com;
return 301 $scheme://xxxx.com$request_uri;
}
server {
## Your website name goes here.
server_name xxxx.com;
## Your only path reference.
root /var/www/xxxx.com;
# This should be in your http block and if it is, it's not needed here.
index index.html index.php;
error_log /var/log/nginx/xxxx.com-error.log;
access_log /var/log/nginx/xxxx.com-access.log;
# Body size (max upload)
# client_max_body_size 64m;
# client_body_buffer_size 2m;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~ /\. {
deny all;
}
# Deny access to any files with a .php extension in the uploads directory
# Works in sub-directory installs and also in multisite network
# Keep logging the requests to parse later (or to pass to firewall utilities such as fail2ban)
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location / {
# This is cool because no php is touched for static content
try_files $uri $uri/ /index.php?$args;
# This to stop connection timeout
proxy_http_version 1.1;
proxy_set_header Connection "";
# Time-out Settings
proxy_send_timeout 150;
proxy_read_timeout 150;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm-sock;
fastcgi_read_timeout 150;
fastcgi_index index.php;
include fastcgi_params;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}}
发布于 2017-05-23 09:31:19
在我本地的nginx机器上开发时,我遇到了同样的问题。
经过广泛的研究,我找到了问题的解决方案(不幸的是,我再也找不到这篇文章了)。
您可以尝试更改以下内容:
fastcgi_pass_unix: localhost:9000;
然后运行'sudo service nginx reload‘。
这为我解决了这个问题。希望对你来说也是如此。
发布于 2017-05-26 13:21:16
这个问题为我解决了。我对proxy_send_timeout、proxy_read_timeout和fastcgi_read_timeout进行了注释,但在下面的代码中保留了proxy_http_version和proxy_set_header。
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
# proxy_send_timeout 150;
# proxy_read_timeout 150;
}
https://stackoverflow.com/questions/44118131
复制相似问题