Join the community today
Register Now

Nginx Redirect to domain TTFB very slow

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by pamamolf, Dec 31, 2014.

  1. pamamolf

    pamamolf Well-Known Member

    2,722
    242
    63
    May 31, 2014
    Ratings:
    +433
    Local Time:
    10:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Hi

    On my centminmod server i use a domain "domain.com" and i have all files here:

    Code:
    /home/nginxs/domains/mydomain.com/public
    There i have a folder named "gadgets" and i have some files there and i use a redirect to another domain for this folder.

    So if a user types seconddomain.com it goes to the folder gadgets in the first domains folder and get al results.....

    The problem is that is very slow (first domain is loading super fast !) and then checking i found this :

    [​IMG]

    So Time to first byte is very slow 6 seconds :(

    No idea how can fix this :(

    And i can't move that folder to the new created account that i redirect as the files inside gadgets are interacting with other files there from main account.....

    second domain config:

    Code:
    server {
      listen 80;
      server_name mydomain.com;
      return 301 $scheme://www.mydomain.com$request_uri;
    }
    
    server {
      listen 80;
      server_name blog.mydomain.com;
      root /home/nginx/domains/firstdomain/public/blog;
      index index.php;
      access_log /var/log/nginx/blog.gogadget.gr_access.log;
      error_log /var/log/nginx/blog.gogadget.gr_error.log;
      location / {
        try_files $uri $uri/ /index.html /index.php?$args;
    
      }
    
    }
    
    server {
      listen 80;
    
      server_name www.mydomain.com dev.mydomain.com;
    
      root /home/nginx/domains/firstdomain.com/public;
    
      index index.php;
    
      access_log /var/log/nginx/mydomain.com_access.log;
      error_log /var/log/nginx/mydomain.com_error.log;
    
    
    location /go {
      return 301 http://www.mydomain.com/;
    
    }
    
      location / {
        try_files $uri $uri/ /index.html /index.php?$args;
      }
    
      location /blog/ {
        deny all;
      }
    
    error_page 500 502 504 /500.html;
    
      location ~* ^.+\.(?:css|cur|js|jpg|jpeg|gif|ico|png|html|xml|zip|rar|mp4|3gp|flv|webm|f4v|ogm)$ {
        access_log off;
        expires 30d;
        tcp_nodelay off;
        open_file_cache max=3000 inactive=120s;
        open_file_cache_valid 45s;
        open_file_cache_min_uses 2;
        open_file_cache_errors off;
    
      }
    
    
      location /api2/ {
        rewrite ^/api2/(.*)$ /api/public/index.php?route=$1 last;
      }
    
      location ~* /(uploads|public)/ {
        access_log off;
        expires 30d;
      }
    
      location ~ /\.ht {
        deny all;
      }
    
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
      include /usr/local/nginx/conf/drop.conf;
      include /usr/local/nginx/conf/block.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
    }
    
    Any ideas?

    I am using ZendOpcache and Memcached...

    Thanks
     
    Last edited: Dec 31, 2014
  2. eva2000

    eva2000 Administrator Staff Member

    30,160
    6,784
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,135
    Local Time:
    5:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    Centmin Mod LEMP stack is provided as is, so this is something you'd need to figure out yourself.
     
  3. pamamolf

    pamamolf Well-Known Member

    2,722
    242
    63
    May 31, 2014
    Ratings:
    +433
    Local Time:
    10:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    ok :(

    Have a nice new year George and thanks for your help and Centminmod :)
     
  4. pamamolf

    pamamolf Well-Known Member

    2,722
    242
    63
    May 31, 2014
    Ratings:
    +433
    Local Time:
    10:03 AM
    Nginx-1.13.x
    MariaDB 10.1.x
    Does the second account share the same resources and settings for phpfpm?

    I mean does it use the same www default pool or has separated settings like phpmyadmin?
     
    Last edited: Dec 31, 2014
  5. eva2000

    eva2000 Administrator Staff Member

    30,160
    6,784
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,135
    Local Time:
    5:03 PM
    Nginx 1.13.x
    MariaDB 5.5
    By default all Nginx vhost created accounts on Centmin Mod use a single PHP-FPM pool named www. Exception is the phpmyadmin installer addon for Centmin Mod creates it's own separate PHP-FPM pool with own user for security.