• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • 😌 This community is user driven. Be polite with other users.
    • 👉 Is required to purchase a Chevereto license to participate in this community (doesn't apply to Pre-sales).
    • 💸 Purchase a Pro Subscription to get access to active software support and faster ticket response times.
  • Chevereto Support CLST

    Support response

    Support checklist

Getting 2 seconds TTFB on every page load

Mr_Moose

Chevereto Member
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]
 
Thanks for the tips, tried gtmetrix, there seems to be a few things to optimize but still 95%. Location shouldn't be the problem, the server is nearby and other php sites on the same server has a TTFB of less than 10ms on average. TTFB is the time it takes for the server to run all the php scripts and start to send the result, so the problem is either in Chevereto or some of the servers config parameters.
 
How are you measuring this out of curiosity? I just tested my site on bytecheck.com and got this
 

Attachments

  • Screenshot 2020-11-02 at 19.54.05.png
    Screenshot 2020-11-02 at 19.54.05.png
    63.6 KB · Views: 7
Using the "network" section in the browsers dev tools, same results in Firefox as well as chromium based browsers. Oddly enough bytecheck.com reports 17ms while browsers report over 2 seconds and clearly takes over 2 seconds to respond.
Perhaps your TTFB is local...
Perhaps, never thought of that. Although I get the same results from different devices, and via VPN. Even tried the Elinks browser from various VPS instances, still 2 seconds TTFB.

Update, checked bytecheck.com again and noticed a status code of 403 instead of 200. That would explain the 17ms TTFB, the servers normal response time. Not sure why that happens tho, the site is in public mode and reachable by any device and browser.
 
Last edited:
Back
Top