Quick site when access by IP, but super slow via Domain Name [closed]

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 10 seconds to open, I did some tests on my local machine and this was the result

(Image 1):

ImadeaVNCaccessontheservertotestandtheproblemisthesameaccessingthepagesfrominsidetheserveritself(Image2):

The support of the hostinger only states that the problem is with some script on my site but I know it is not because otherwise it 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 pings very well in both cases.

Does anyone have a clue what might be happening? I'm using ubuntu 16.04, kernel 4 with Apache 2

    
asked by anonymous 30.09.2016 / 11:56

2 answers

2

RESOLVED

I discovered something here that resolved, one of my css was being dynamically generated and after I generated it, I inserted it in the page using file_get_contents ($ CSS_Gerado_Dinamicamente_com_PHP), I do not know the reason but when accessing using IP, both css was generated dynamically normally when file-get_content () also worked normally, but when I accessed the domain name, something was done or CSS was not generated immediately or file-get_content () did not work, I still can not understand the connection between this and this I could not solve, the alternative was to create a static css from the css that was created dynamically, I executed the code:

-file.css.php -

<?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 file-get_content(../cache/CSS_Estatico.css) inside my, everything works perfectly, I know it does not make any sense because if the problem was in css that is dynamically created, the problem would happen when accessing directly through IP as well.

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

If someone knows where the connection 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 have the same problem.

Thank you very much for the tips and PROBLEM SOLVED

PS (The hostinger is terrible to give any support, they have never been able to help me at all and I have never met anyone who got some help from them)

    
30.09.2016 / 16:02
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 anyone has the same problem, I solved it like this:

-I set up DNS for bind 9 and the main problem has been solved, now both domain name and IP access are legal, both with the same speed regardless of whether my files are static or dynamic.

    
05.10.2016 / 05:26