500 internal server error.Помогите.

123
obius
На сайте с 19.08.2015
Offline
56
#11
maxicccc:
Так а почему ошибка то 500?
В логе куча вот такого
2016/06/17 00:15:29 [alert] 2604#2604: *228652 socket() failed (24: Too many open files) while connecting to upstream, client: 95.213.236.186, server: _, request: "GET / HTTP/1.0", upstream: "http://92.213.224.126:8080/", host: "MySite"

Где директива server {} ? в папке /etc/nginx/conf.d/ с остальными конфигами?

95.213.236.186:8080 - тут apache или php-fpm?

M
На сайте с 17.04.2015
Offline
11
#12
obius:
Где директива server {} ? в папке /etc/nginx/conf.d/ с остальными конфигами?
95.213.236.186:8080 - тут apache или php-fpm?

Да,директива в /etc/nginx/conf.d/

Apache.

obius
На сайте с 19.08.2015
Offline
56
#13
maxicccc:
Да,директива в /etc/nginx/conf.d/
Apache.

А логи апач и пхп без ошибок?

Выполните в консоле VPS:

for pid in `pidof nginx`; do echo "$(< /proc/$pid/cmdline)"; egrep 'files|Limit' /proc/$pid/limits; echo "Currently open files: $(ls -1 /proc/$pid/fd | wc -l)"; echo; done

Вроде как явные проблемы с лимитами.

M
На сайте с 17.04.2015
Offline
11
#14
obius:
А логи апач и пхп без ошибок?

В логе апача гора вот такого

[Mon Jun 20 01:48:17.379117 2016] [autoindex:error] [pid 17569] [client 95.213.236.186:45594] AH01276: Cannot serve directory /var/www/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive

Логов PHP не вижу.

obius
На сайте с 19.08.2015
Offline
56
#15
maxicccc:
В логе апача гора вот такого
[Mon Jun 20 01:48:17.379117 2016] [autoindex:error] [pid 17569] [client 95.213.236.186:45594] AH01276: Cannot serve directory /var/www/: No matching DirectoryIndex (index.html,index.cgi,index.pl,index.php,index.xhtml,index.htm) found, and server-generated directory index forbidden by Options directive
Логов PHP не вижу.

Конфиг апача нужно будет тоже править как минимум DirectoryIndex, если это конечно не связано с лимитами :)

M
На сайте с 17.04.2015
Offline
11
#16
obius:
Конфиг апача нужно будет тоже править :)

Что именно подправить?

# It is split into several files forming the configuration hierarchy outlined

# below, all located in the /etc/apache2/ directory:

#

# /etc/apache2/

# |-- apache2.conf

# | `-- ports.conf

# |-- mods-enabled

# | |-- *.load

# | `-- *.conf

# |-- conf.d

# | `-- *

# Global configuration

PidFile ${APACHE_PID_FILE}

Timeout 30

KeepAlive Off

MaxKeepAliveRequests 500

KeepAliveTimeout 5

<IfModule mpm_prefork_module>

StartServers 10

MinSpareServers 20

MaxSpareServers 150

ServerLimit 256

MaxClients 170

MaxRequestsPerChild 10000

</IfModule>

<IfModule mpm_worker_module>

StartServers 3

MinSpareThreads 25

MaxSpareThreads 75

ThreadLimit 64

ThreadsPerChild 25

MaxClients 2000

MaxRequestsPerChild 4000

</IfModule>

<IfModule mpm_event_module>

StartServers 2

MinSpareThreads 25

MaxSpareThreads 75

ThreadLimit 64

ThreadsPerChild 25

MaxClients 2000

MaxRequestsPerChild 4000

</IfModule>

# These need to be set in /etc/apache2/envvars

User ${APACHE_RUN_USER}

Group ${APACHE_RUN_GROUP}

#User www-data

#Group www-data

AccessFileName .htaccess

<Files ~ "^\.ht">

Order allow,deny

Deny from all

Satisfy all

</Files>

DefaultType None

HostnameLookups Off

ErrorLog ${APACHE_LOG_DIR}/error.log

LogLevel warn

# Include module configuration:

Include mods-enabled/*.load

Include mods-enabled/*.conf

# Include list of ports to listen on and which to use for name based vhosts

Include ports.conf

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %O" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

LogFormat "%b" bytes

Include conf.d/

# Include the virtual host configurations:

#Include sites-enabled/

---------- Добавлено 20.06.2016 в 02:59 ----------

---------- Добавлено 20.06.2016 в 03:00 ----------

obius:
Конфиг апача нужно будет тоже править как минимум DirectoryIndex, если это конечно не связано с лимитами :)

Если не ддосить,все нормально.
obius
На сайте с 19.08.2015
Offline
56
#17

В папке /etc/apache2/conf.d/ еще конфиги. Выполните то что написал в #14 посту.

Не хотите вникать в тонкости настройки, наймите фрилансера для настройки фронтэнд/бэкэнда.

Ну если не поможет, без защиты от ддос не обойтись :)

M
На сайте с 17.04.2015
Offline
11
#18
obius:
В папке /etc/apache2/conf.d/ еще конфиги. Выполните то что написал в #14 посту.

У меня там нет конфигов почему-то.

Только файл с вот этим Listen 95.213.236.186:8080

Listen 95.213.236.186:8443

И две папочки, в которые не зайти.

Error: Directory /etc/phpmyadmin/apache.conf: no such file or directory

Error: Failed to retrieve directory listing

---------- Добавлено 20.06.2016 в 03:08 ----------

obius:
В папке /etc/apache2/conf.d/ еще конфиги. Выполните то что написал в #14 посту.

Выполнил то что в вашем посту.

root@cs34990:~# for pid in `pidof nginx`; do echo "$(< /proc/$pid/cmdline)"; egr ep 'files|Limit' /proc/$pid/limits; echo "Currently open files: $(ls -1 /proc/$p id/fd | wc -l)"; echo; done

nginx: cache manager process

Limit Soft Limit Hard Limit Units

Max open files 1024 4096 files

Currently open files: 10

nginx: worker process

Limit Soft Limit Hard Limit Units

Max open files 1024 4096 files

Currently open files: 1024

nginx: worker process

Limit Soft Limit Hard Limit Units

Max open files 1024 4096 files

Currently open files: 1024

nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf

Limit Soft Limit Hard Limit Units

Max open files 1024 4096 files

Currently open files: 12

obius
На сайте с 19.08.2015
Offline
56
#19


nginx: worker process
Limit Soft Limit Hard Limit Units
Max open files 1024 4096 files
Currently open files: 1024

nginx: worker process
Limit Soft Limit Hard Limit Units
Max open files 1024 4096 files
Currently open files: 1024

Вот и ответ. Ваши worker_processes 2; и лимит открытых файлов в 1024.

M
На сайте с 17.04.2015
Offline
11
#20
obius:

nginx: worker process
Limit Soft Limit Hard Limit Units
Max open files 1024 4096 files
Currently open files: 1024

nginx: worker process
Limit Soft Limit Hard Limit Units
Max open files 1024 4096 files
Currently open files: 1024


Вот и ответ. Ваши worker_processes 2; + worker_rlimit_nofile у которого по умолчанию 1024

Выставил побольше worker_processes,vps легла напрочь :)

123

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий