sarkisssik
@sarkisssik

Что не так с конфигом FastCGI (Nginx + PHP-FPM)?

7 X Intel(R) Xeon(R) E-2288G CPU @ 3.70GHz озу 14гб
FastCGI (Nginx + PHP-FPM) php 5.6.4

Сначала было все хорошо, но последнее время заметил, что сайт начал работать медленно. Нагрузки на систему нет.
Если даже запускать пустые скрипты с текстом Hello World, то они очень долго обрабатываются. 1-2 сек.
Подскажите, что нужно настроить или на что обратить внимание ?

Если сайт переключить на apache, то вполне быстро работает все .

server {



	server_name мой_сайт.ru *.мой_сайт.ru www.мой_сайт.ru;
	charset UTF-8;
	index index.php index.html;
	disable_symlinks if_not_owner from=$root_path;
	include /etc/nginx/vhosts-includes/*.conf;
	include /etc/nginx/vhosts-resources/мой_сайт.ru/*.conf;
	access_log /var/www/httpd-logs/мой_сайт.ru.access.log;
	error_log /var/www/httpd-logs/мой_сайт.ru.error.log notice;
	
	return 301 https://$host:443$request_uri;
	

	
	
	
	
	
	set $root_path /var/www/мой_сайт.ru/data/www/мой_сайт.ru;
	location / {
		location ~ [^/]\.ph(p\d*|tml)$ {
			try_files /does_not_exists @php;
		}
		location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
			expires 7d;
		}
	}
	
	
	 return 301 https://$host$request_uri;
	
	return 301 https://$host:443$request_uri;
	root $root_path;
	gzip on;
	gzip_comp_level 6;
	gzip_disable "msie6";
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
	listen 37.333.117.333:80 default_server;
	location @php {
		fastcgi_index index.php;
		fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f support@мой_сайт.ru";
		fastcgi_pass unix:/var/www/php-fpm/1.sock;
		fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
		try_files $uri =404;
		include fastcgi_params;
	}
}



server {


	

	server_name мой_сайт.ru *.мой_сайт.ru www.мой_сайт.ru;
	ssl_certificate "/var/www/httpd-cert/мой_сайт.ru/мой_сайт.ru_custom_1.crtca";
	ssl_certificate_key "/var/www/httpd-cert/мой_сайт.ru/мой_сайт.ru_custom_1.key";
	ssl_ciphers EECDH:+AES256:-3DES:RSA+AES:!NULL:!RC4;
	ssl_prefer_server_ciphers on;
	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
	ssl_dhparam /etc/ssl/certs/dhparam4096.pem;
	charset UTF-8;
	index index.php index.html;
	disable_symlinks if_not_owner from=$root_path;
	include /etc/nginx/vhosts-includes/*.conf;
	include /etc/nginx/vhosts-resources/мой_сайт.ru/*.conf;
	access_log /var/www/httpd-logs/мой_сайт.ru.access.log;
	error_log /var/www/httpd-logs/мой_сайт.ru.error.log crit;
	set $root_path /var/www/мой_сайт.ru/data/www/мой_сайт.ru;
	
	error_page 404 /index.php?error;

    #return 301 https://$host:443$request_uri;









    if ($request_uri ~* "^/index\.php$") {
       return 301 /;
   }




    if ($host ~* www\.(.*)) {
        set $host_without_www $1;
        rewrite ^(.*)$ https://$host_without_www$1 permanent;
    }








	location / {
		location ~ [^/]\.ph(p\d*|tml)$ {
			try_files /does_not_exists @php;
		}
		location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
			expires 7d;
		}
		

	
	
	}
	
	

        


     	
	
	
	root $root_path;

    if ($host != $server_name) {
      return 444;
     }


	gzip on;
	gzip_comp_level 6;
	gzip_disable "msie6";
	gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
	error_log /var/www/httpd-logs/мой_сайт.ru.error.log notice;
	listen 37.333.117.333:443 ssl default_server;
	location @php {
		fastcgi_index index.php;
		fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f support@мой_сайт.ru";
		fastcgi_pass unix:/var/www/php-fpm/1.sock;
		fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
		try_files $uri =404;
		include fastcgi_params;
	}
}
  • Вопрос задан
  • 127 просмотров
Пригласить эксперта
Ответы на вопрос 1
ky0
@ky0 Куратор тега Nginx
Миллиардер, филантроп, патологический лгун
Апач тоже работает с FPM или всё-таки с модулем? Если да - дело в настройках PHP.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы