1

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.

Shared hosting: it takes 636ms to resolve

VPS: it takes 1670ms to resolve

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.

  1. nginx:latest
  2. Laravel app (the one that has the nginx.conf)
  3. SQL instance
  4. phpmyadmin

Any help would be so much appreciated, as I am in prod and it's a complete nightmare. Thanks!

4
  • 1
    You have 3 components (nginx/app/DB) and underlying OS that all affect the performance and you provide information about only nginx, which is the one that is the least likely to be a bottleneck. You are looking under a lamppost. Commented Mar 30, 2024 at 7:31
  • I have the same website on a shared hosting plan. It is working very fast. I recently edited the nginx.conf file and updated www record to point to hostinger cdn, now any request to www. subdomain resolves under ~300ms, but to the main domain, it takes 1200ms. Commented Mar 30, 2024 at 12:02
  • What about caching? Maybe the shared hosting is caching results and the backend system is slow. There is no caching turned on in your nginx conf. Commented Mar 31, 2024 at 3:04
  • I used another template, Laravel template, and all just worked out. I was using a Docker template Commented Apr 2, 2024 at 18:59

1 Answer 1

-1

I used another template, Laravel template, and all just worked out. I was using a Docker template.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.