I just upgraded my shared hosting to a VPS (both on hostinger), the VPS has 2 vCPUs and 8GB Ram (Shared hosting had 2vCPUs and less Ram), always below 5% CPU usage & 25% Ram usage.
However, the VPS is much slower than the shared hosting. It takes at least 2 times longer on the VPS to resolve a single request.
That is my current Nginx script - nginx.conf (exists in the laravel app docker image)
server {
listen 80;
server_name domain.com www.domain.com;
# Redirect HTTP to HTTPS
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name domain.com www.domain.com;
ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;
root /var/www/html/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
# include snippets/fastcgi-php.conf;
fastcgi_pass app:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Also, when opening the app that talks to the server, it feels like it resolves one request at a time, a couple of requests (loading the home page), takes 20 seconds to finish, everytime. On the shared hosting it wasn't more than 2 seconds.
I am using cloudflare on both (VPS and Hostinger).
Also, my server got 4 docker images.
- nginx:latest
- Laravel app (the one that has the nginx.conf)
- SQL instance
- phpmyadmin
Any help would be so much appreciated, as I am in prod and it's a complete nightmare. Thanks!


Enable Gzip compression to reduce the size of transmitted data.
Modify
httpblock of your nginx configuration