y lograr sacar el máximo provecho?
Tengo un VPS en digitalocean con
CPU(s): 12
Thread(s) per core: 1
Core(s) per socket: 1
Socket(s): 12
Ram 32gb
SSD 320 gb
El CPU jamas se satura, si al caso llega al 10% de consumo y de ram llego a ocupar los 5gb
La base de datos pesa 1.2 GB
Y trabaja relativamente bien, pero apenas sube el trafico por alguna publicación relevante el servidor empieza a indicar que no puede responder la solicitud y manda error 500
Siendo que el procesador y la ram están bien relax sin carga que sature todo.
En el ultimo año he hecho infinidad de cambios intentando mejorar el rendimiento.,
Estas son las configuraciones que tengo en mi nginx.conf
Cita:
user nginx;
worker_processes 10;
worker_rlimit_nofile 65535;
error_log /var/log/nginx/error.log error;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 3;
types_hash_max_size 5120;
client_body_timeout 12;
client_header_timeout 12;
send_timeout 10;
gzip on;
gzip_disable "msie6";
gzip_vary on;
#gzip_min_length 10240;
#gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
client_body_buffer_size 128K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name xxxxxx.com;
rewrite ^/xxxx/$ http://yyyyy/ permanent;
rewrite ^/xxxx/$ http://yyyyy/ permanent;
root /var/www/xxxxx;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404-redirect.php;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
#fastcgi_param PHP_VALUE 128M
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
fastcgi_read_timeout 300;
}
location ~ /\.(ht|ssh) {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 360d;
log_not_found off;
access_log off;
}
}
worker_processes 10;
worker_rlimit_nofile 65535;
error_log /var/log/nginx/error.log error;
events {
worker_connections 2048;
multi_accept on;
use epoll;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 3;
types_hash_max_size 5120;
client_body_timeout 12;
client_header_timeout 12;
send_timeout 10;
gzip on;
gzip_disable "msie6";
gzip_vary on;
#gzip_min_length 10240;
#gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 1000;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
client_body_buffer_size 128K;
client_header_buffer_size 1k;
client_max_body_size 8m;
large_client_header_buffers 2 1k;
include /etc/nginx/mime.types;
default_type application/octet-stream;
server {
listen 80;
server_name xxxxxx.com;
rewrite ^/xxxx/$ http://yyyyy/ permanent;
rewrite ^/xxxx/$ http://yyyyy/ permanent;
root /var/www/xxxxx;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
error_page 404 /404-redirect.php;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location = /xmlrpc.php {
deny all;
access_log off;
log_not_found off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/run/php-fpm/www.sock;
fastcgi_intercept_errors on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
#fastcgi_param PHP_VALUE 128M
fastcgi_buffer_size 128k;
fastcgi_buffers 256 16k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;
include fastcgi_params;
fastcgi_read_timeout 300;
}
location ~ /\.(ht|ssh) {
deny all;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 360d;
log_not_found off;
access_log off;
}
}