Quantcast
Channel: Linux.org.ru: Форум
Viewing all articles
Browse latest Browse all 108369

почему возникает connection timeout nginx и 503 ошибка?

$
0
0

ИТ - коллеги, здравствуйте!

Обращаюсь за помощью к вам.

Ситуация. В логах nginx ошибка

*2283376 connect() failed (110: Connection timed out) while connecting to upstream, client: 130.193.37.19, server: server.ru, request: «GET /catalog/polki-dlya-vannoy/00006183 HTTP/1.1», upstream: "http://127.0.0.1:8887/catalog/polki-dlya-vannoy/00006183", host: «server.ru»

Пользователи сайта жалуются, что сайт не работает. Ошибка - Service temporarily unavailable.

Вопрос. Как найти причину Connection timed out? И устранить её.

Что пробовали делать. Менять таймауты nginx

        proxy_connect_timeout           500;
        proxy_send_timeout              500;
        proxy_read_timeout              500;

Это не решение. Ошибка пропала, но сайт не доступен пользователю.

Менять настройки prefork на рекомендуемые битрикс.

<IfModule prefork.c>
StartServers 20
MinSpareServers 10
MaxSpareServers 30
MaxClients 30
MaxRequestsPerChild 1000
</IfModule>

Не помогло.

На сервере настроен мониторинг. Можно смотреть загрузку сеть, диски, соединения, mysql запросы.

Гипотезы.

Загибается апатч. Какие- то параметры апач достигают максимум и от выдаёт timeout nginx. Какие настройки апач проверить?
Апач загибается из за настроек php. Какие настройки php проверить?

Сайт на битрикс, vds.

Аппаратная конфигурация сервера:

  • RAM 40 G, свободно 34 g.
  • HDD (raid 1, 2* SAS 15k) 120G свободно 40 G

Программная конфигурация:

  • Версия ОС - CentOS release 6.2
  • Версия битрикс окружения - 3.01
  • Версия php - 5.3.14
  • Версия nginx - 1.0.6
  • Версия mysql - 5.1.69-log
  • Версия apache - 2.2.15

Конфигурации nginx

user bitrix;
worker_processes 8;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
worker_rlimit_nofile 10240;

events {
        use epoll;
        worker_connections  10240;
}

http {
        include /etc/nginx/mime.types;
        default_type application/octet-stream;
        log_format main '$remote_addr - $remote_user [$time_local] $status                                '
                        '"$request" $body_bytes_sent "$http_referer" '
                        '"$http_user_agent" "$http_x_forwarded_for"';
         log_format main2 '$remote_addr - $remote_user [$time_local] $host $request '
                '$status $body_bytes_sent "$http_referer" "$http_user_agent" '
                '"$http_x_forwarded_for" $request_time-$upstream_response_time';

        log_format common '$remote_addr - - [$time_local] "$request" $status $bytes_sent "$http_referer" "$http_user_agent" $msec';
        #access_log /var/log/nginx/access.log  common;
        access_log                      off;
        sendfile                        on;
        tcp_nopush                      on;
        tcp_nodelay                     on;

        client_max_body_size            1024m;
        client_body_buffer_size         4m;

        proxy_connect_timeout           500;
        proxy_send_timeout              500;
        proxy_read_timeout              500;
        proxy_buffer_size               64k;
        proxy_buffers                   8 256k;
        proxy_busy_buffers_size         256k;
        proxy_temp_file_write_size      10m;

        error_page 500 502 503 504 /500.html;
        error_page 404 = /404.php;

        gzip                    on;
        gzip_proxied            any;
        gzip_static             on;
        gzip_http_version       1.0;
        gzip_types              application/x-javascript text/css;

        include conf.d/*;
        include bx/site_enabled/*.conf;
        include bx/site_ext_enabled/*.conf;

}

Конфигурация apache

ServerTokens OS
ServerRoot "/etc/httpd"
PidFile run/httpd.pid
Timeout 120
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule prefork.c>
StartServers 20
MinSpareServers 10
MaxSpareServers 30
MaxClients 30
MaxRequestsPerChild 1000
</IfModule>

<IfModule worker.c>
StartServers 20
MinSpareServers 10
MaxSpareServers 30
MaxClients 30
MaxRequestsPerChild 1000
</IfModule>


LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule include_module modules/mod_include.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule logio_module modules/mod_logio.so
LoadModule env_module modules/mod_env.so
LoadModule ext_filter_module modules/mod_ext_filter.so
LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule info_module modules/mod_info.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule dir_module modules/mod_dir.so
LoadModule actions_module modules/mod_actions.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so

Include conf.d/*.conf

User bitrix
Group bitrix

ServerAdmin root@localhost

UseCanonicalName Off

DocumentRoot "/home/bitrix/www"

<Directory />
    Options FollowSymLinks
    AllowOverride None


</Directory>

<IfModule mod_userdir.c>
    UserDir disable
</IfModule>

DirectoryIndex index.html index.html.var

AccessFileName .htaccess

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

TypesConfig /etc/mime.types
DefaultType text/plain
<IfModule mod_mime_magic.c>
    MIMEMagicFile conf/magic
</IfModule>

HostnameLookups On

ErrorLog logs/error_log

LogLevel warn
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent


ServerSignature On

<IfModule mod_dav_fs.c>
    # Location of the WebDAV lock database.
    DAVLockDB /var/lib/dav/lockdb
</IfModule>

IndexOptions FancyIndexing VersionSort NameWidth=* HTMLTable

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

AddLanguage ca .ca
AddLanguage cs .cz .cs
AddLanguage da .dk
AddLanguage de .de
AddLanguage el .el
AddLanguage en .en
AddLanguage eo .eo
AddLanguage es .es
AddLanguage et .et
AddLanguage fr .fr
AddLanguage he .he
AddLanguage hr .hr
AddLanguage it .it
AddLanguage ja .ja
AddLanguage ko .ko
AddLanguage ltz .ltz
AddLanguage nl .nl
AddLanguage nn .nn
AddLanguage no .no
AddLanguage pl .po
AddLanguage pt .pt
AddLanguage pt-BR .pt-br
AddLanguage ru .ru
AddLanguage sv .sv
AddLanguage zh-CN .zh-cn
AddLanguage zh-TW .zh-tw



AddDefaultCharset UTF-8

AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz

AddHandler type-map var
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

BrowserMatch "Mozilla/2" nokeepalive
BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
BrowserMatch "RealPlayer 4\.0" force-response-1.0
BrowserMatch "Java/1\.0" force-response-1.0
BrowserMatch "JDK/1\.0" force-response-1.0
<IfModule mod_status.c>
ExtendedStatus On
<Location /server-status>
    SetHandler server-status
    Allow from all
</Location>
</IfModule>


Конфигурация virtual host

<VirtualHost *:8887>
        ServerName server.ru
        ServerAlias www.server.ru
        ServerAdmin webmaster@localhost
        DocumentRoot /home/bitrix/ext_www/lmh



        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>

        <Directory /home/bitrix/ext_www/lmh>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                DirectoryIndex index.php index.html index.htm
                Order allow,deny
                allow from all
        </Directory>

        ErrorLog logs/error_log
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn


    <IfModule mod_rewrite.c>
    #Nginx should have "proxy_set_header HTTPS YES;" in location
    RewriteEngine On
    RewriteCond %{HTTP:HTTPS} =YES
    RewriteRule .* - [E=HTTPS:on,L]
    </IfModule>

</VirtualHost>

 , ,


Viewing all articles
Browse latest Browse all 108369

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>