Old time user trying to setup Chevereto again, so I've followed the official installation tutorial while installing on a dedicated server using nginx 1.19 and php-fpm 7.4. Everything wen't smooth and the site is up and running using essentially the standard configuration. External storage has been set to a S3 bucket, confirmed and working.
Now the problem is that on every page load it takes at least 2 seconds (TTFB) until the site starts to load. When looking at other Chevereto installations like imgbb that loads in less then a second. I'm not sure if the problem is with Chevereto, the server or both. Does anyone else have similar problems or any ideas for solutions on how to reduce loading speed? The same server hosts other php sites which loads in less than 100ms and TTFB of less than 10ms.
Nginx config:
[CODE lang="nginx" title="nginx config"]server {
listen 8080;
listen [::]:8080;
# Define server name, index and root
server_name www.example.com example.com;
root /var/www/example.com/public;
index index.php index.html;
# Access files or rewrite to pretty url
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
# Context limits
client_max_body_size 20M;
# Disable access to sensitive files
location ~* /(app|content|lib)/.*\.(po|php|lock|sql)$ {
deny all;
}
location ~ /(\.ht|composer) {
deny all;
}
# Image not found replacement
location ~ \.(jpe?g|png|gif|webp)$ {
log_not_found off;
error_page 404 /content/images/system/default/404.gif;
}
# CORS header (avoids font rendering issues)
location ~* /.*\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";
}
location ~ \.php$ {
include conf.d/fastcgi-php.vhost;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}[/CODE]
Nginx is behind a haproxy server in a different availability zone who manages TLS for all sites on the server. None of the servers has any bottlenecks.
[CODE title="fastcgi-php.vhost"]# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;[/CODE]
Now the problem is that on every page load it takes at least 2 seconds (TTFB) until the site starts to load. When looking at other Chevereto installations like imgbb that loads in less then a second. I'm not sure if the problem is with Chevereto, the server or both. Does anyone else have similar problems or any ideas for solutions on how to reduce loading speed? The same server hosts other php sites which loads in less than 100ms and TTFB of less than 10ms.
Nginx config:
[CODE lang="nginx" title="nginx config"]server {
listen 8080;
listen [::]:8080;
# Define server name, index and root
server_name www.example.com example.com;
root /var/www/example.com/public;
index index.php index.html;
# Access files or rewrite to pretty url
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
}
# Context limits
client_max_body_size 20M;
# Disable access to sensitive files
location ~* /(app|content|lib)/.*\.(po|php|lock|sql)$ {
deny all;
}
location ~ /(\.ht|composer) {
deny all;
}
# Image not found replacement
location ~ \.(jpe?g|png|gif|webp)$ {
log_not_found off;
error_page 404 /content/images/system/default/404.gif;
}
# CORS header (avoids font rendering issues)
location ~* /.*\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$ {
add_header Access-Control-Allow-Origin "*";
}
location ~ \.php$ {
include conf.d/fastcgi-php.vhost;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
}
}[/CODE]
Nginx is behind a haproxy server in a different availability zone who manages TLS for all sites on the server. None of the servers has any bottlenecks.
[CODE title="fastcgi-php.vhost"]# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;[/CODE]