Fast website when accessed by IP, but super slow via Domain Name

Asked

Viewed 736 times

1

I’m having a problem that when accessing my VPS server using IP, access is immediate but when access using HTTP, the page takes up to 10 seconds to open, I did some tests on my local machine and this was the result

(Image 1): Imagem comparando IP e Dominio

I made an access via VNC on the server to test and the problem is the same by accessing the pages from inside the server (Imagem2):

Imagem de comparação entre IP e dominio de dentro do servidor

The support of Hostinger only states that the problem is with some script on my site but I know it is not because otherwise would give problem using the IP address. I ping both using IP and domain and the result is the same, IE, the server is responding to the pings very well in both cases.

Does anyone have any idea what could be going on? I am using Ubuntu 16.04, kernel 4 with Apache 2

  • Friend, where are you doing the name resolution? ie DNS? in which company is your domain allocated? In your network. your computer goes straight to modem? or has router? this seems to me DNS problems. -

  • So, I’m using the Hostinger, what has bugged me for once now is that the store.zenycosta.com Ubdomain is working perfectly as well as the IP 153.92.208.69/store

  • Buddy, you got some points to check out, how do you know it’s working perfectly? If the problem is when using the name solved, check the DNS server, see the route as configured, see your domain settings, and then let Hostinger escape.

2 answers

2

RESOLVED

I discovered something here that solved, one of my css were being generated dynamically and after generated, I inserted it into the page using file_get_contents($Css_generated dynamic_dynamic_com_php), I do not know the reason but when accessing using IP, both the css was generated dynamically normally and the file-get_content() also worked normally, but when I accessed by the domain name, something did either the CSS not be generated immediately or the file-get_content() did not work, I still could not understand the connection between that and that could not solve, the alternative was to create a static css from the css that was created dynamically, ran the code:

-php.css.-

<?php
$CSS_Estatico = '../cache/headline.css';
if (file_exists($CSS_Estatico)) {
    include($CSS_Estatico);
    exit;
}
ob_start();

--Meu Código CSS--

$cached = fopen($CSS_Estatico, 'w');
fwrite($cached, ob_get_contents());
fclose($cached);
ob_end_flush(); // Send the output to the browser
?>

so when I run the file-get_content(../cache/CSS_Estatico.css) inside my , everything works perfectly, I know it doesn’t make the slightest sense pq if the problem was in the css that is created dynamically, the problem would happen when accessing directly through the IP also.

Then I just had to modify my CMS for every time I post something new, it recreates this static CSS like a cache.

If anyone knows where the connection is between my dynamic CSS and the problem of slowness when using the domain name, feel free to leave the theory of what could be pa who has the same problem.

Thank you every way for the tips and PROBLEM SOLVED

P.S. (The Hostinger is terrible to give some support, they never managed to help me at all and I never met anyone who got any help from them)

0

SOLVED 2

The solution I gave above was an alternative to the real problem but I found the solution to the original problem, if someone has the same problem, I solved so:

-I set up the DNS by bind 9 and the main problem was solved, now both the access via Domain Name and via IP is cool, both with the same speed regardless of whether my files are static or dynamic.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.