Error 504 and 502 when importing


#1

Hi , Everyone.

I know this error could be fixed by importing//exporting the db.

But I can’t do this because we only have a CSV with all the content of a old WP.

So We follow the NIGNX-PHP-FPM installation in a LINODE and we add SSL certificates.

so every time we tried to import this 1.8MB file , we get a 502 error or a 504 error…

we have this config in the nginx.conf:

server {  
  # listen 80 deferred; # for Linux  
  # listen 80 accept_filter=httpready; # for FreeBSD  
  listen 80;  

  # The host name to respond to  
  server_name mysuperbigsite.cool *.mysuperbigsite.cool;  

  # Path for static files  
  root /sites/mysuperbigsite.cool/public;  

  # Try static files first, then php  
  index index.html index.htm index.php;  

  # Specific logs for this vhost  
  access_log /sites/mysuperbigsite.cool/log/log-access.log;  
  error_log  /sites/mysuperbigsite.cool/log/log-error.log error;  

  #Specify a charset  
  charset utf-8;  

  # Redirect needed to "hide" index.php  
  location / {  
    try_files $uri $uri/ /index.php?q=$uri&$args;  
  }  

  #Yoast sitemap  
  location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {  
    rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;  
    rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;  
    rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;  
    rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;  

    ## following lines are options. Needed for wordpress-seo addons  
    rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last;  
    rewrite ^/locations\.kml$ /index.php?sitemap=wpseo_local_kml last;  
    rewrite ^/geo_sitemap\.xml$ /index.php?sitemap=wpseo_local last;  
    rewrite ^/video-sitemap\.xsl$ /index.php?xsl=video last;  

    access_log off;  
  }  

  # Don't log robots.txt or favicon.ico files  
  location ~* ^/(favicon.ico|robots.txt)$ {  
    access_log off;  
    log_not_found off;  
  }  
  # Custom 404 page  
  error_page 404 /wp-content/themes/depressed/404.php;  

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
  location ~ \.php$ {  
    fastcgi_split_path_info ^(.+\.php)(/.+)$;  
    # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini  

    # With php5-cgi alone:  
    # fastcgi_pass 127.0.0.1:9000;  
    # With php5-fpm:  
    fastcgi_pass unix:/tmp/php5-fpm.depressed.sock;  
    fastcgi_intercept_errors on;  
    fastcgi_index index.php;  
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
    include fastcgi_params;  
  }  

  # Deny access to .htaccess  
  location ~ /\.ht {  
    deny all;  
  }  

  # PHPMYADMIN  
  location /phpmyadmin {  
    root /usr/share/;  
    index index.php index.html index.htm;  
    location ~ ^/phpmyadmin/(.+\.php)$ {  
      try_files $uri =404;  
      root /usr/share/;  
    fastcgi_pass unix:/tmp/php5-fpm.depressed.sock;  
      fastcgi_index index.php;  
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
      include fastcgi_params;  
    }  
    location ~* ^/phpmyadmin/(.+\.(jpeg|jpg|png|css|gif|ico|js|html|xml|txt))$ {  
      root /usr/share/;  
    }  
  }  
  location /phpMyAdmin {  
    rewrite ^/* /phpmyadmin last;  
  }  

  # Include the basic h5bp config set  
  include h5bp/basic.conf;  
}  

#01CDN  

server {  
  # listen 80 deferred; # for Linux  
  # listen 80 accept_filter=httpready; # for FreeBSD  
  listen 80;  

  # The host name to respond to  
  server_name cdn.mysuperbigsite.cool;  

  # Path for static files  
  root /sites/mysuperbigsite.cool/cdn;  

  # Try static files first, then php  
  index index.html index.htm index.php;  

  # Specific logs for this vhost  
  access_log /sites/mysuperbigsite.cool/log/log-cdn-access.log;  
  error_log  /sites/mysuperbigsite.cool/log/log-cdn-error.log error;  

  #Specify a charset  
  charset utf-8;  

  # Redirect needed to "hide" index.php  
  location / {  
    try_files $uri $uri/ /index.php?q=$uri&$args;  
  }  

  # Don't log robots.txt or favicon.ico files  
  location ~* ^/(favicon.ico|robots.txt)$ {  
    access_log off;  
    log_not_found off;  
  }  
  # Custom 404 page  
  error_page 404 /wp-content/themes/depressed/404.php;  

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
  location ~ \.php$ {  
    fastcgi_split_path_info ^(.+\.php)(/.+)$;  
    # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini  

    # With php5-cgi alone:  
    # fastcgi_pass 127.0.0.1:9000;  
    # With php5-fpm:  
    fastcgi_pass unix:/tmp/php5-fpm.depressed.sock;  
    fastcgi_intercept_errors on;  
    fastcgi_index index.php;  
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
    include fastcgi_params;  
  }  

  # Deny access to .htaccess  
  location ~ /\.ht {  
    deny all;  
  }  

  # Include the basic h5bp config set  
  include h5bp/basic.conf;  
}  

#02 DEV  

server {  
  # listen 80 deferred; # for Linux  
  # listen 80 accept_filter=httpready; # for FreeBSD  
  #listen 80;  

  # The host name to respond to  
  server_name dev.mysuperbigsite.cool;  

  # Path for static files  
  root /sites/mysuperbigsite.cool/dev;  

  # Try static files first, then php  
  index index.html index.htm index.php;  

  # Specific logs for this vhost  
  access_log /sites/mysuperbigsite.cool/log/log-dev-access.log;  
  error_log  /sites/mysuperbigsite.cool/log/log-dev-error.log error;  

  #Specify a charset  
  charset utf-8;  

  # Redirect needed to "hide" index.php  
  location / {  
    try_files $uri $uri/ /index.php?q=$uri&$args;  
  }  

  # Don't log robots.txt or favicon.ico files  
  location ~* ^/(favicon.ico|robots.txt)$ {  
    access_log off;  
    log_not_found off;  
  }  
  # Custom 404 page  
  error_page 404 /wp-content/themes/depressed/404.php;  

  # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000  
  location ~ \.php$ {  
    fastcgi_split_path_info ^(.+\.php)(/.+)$;  
    # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini  

    # With php5-cgi alone:  
    # fastcgi_pass 127.0.0.1:9000;  
    # With php5-fpm:  
    fastcgi_pass unix:/tmp/php5-fpm.depressed.sock;  
    fastcgi_intercept_errors on;  
    fastcgi_index index.php;  
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;  
    include fastcgi_params;  
  }  

  # Deny access to .htaccess  
  location ~ /\.ht {  
    deny all;  
  }  

  # Include the basic h5bp config set  
  include h5bp/basic.conf;  
}

my pool.d is:

[depressed]  
user = www-data  
group = www-data  

listen = /tmp/php5-fpm.mysuperbigsite.sock  

pm = dynamic  
pm.max_children = 20  
pm.start_servers = 8  
pm.min_spare_servers = 8  
pm.max_spare_servers = 12  
pm.max_requests = 500  
php_flag[expose_php] = off  
php_flag[short_open_tag] = on  

request_terminate_timeout = 300  

pm.status_path = /status  
ping.path = /ping  

thanks really for all


#2

502 Bad Gateway:
This error comes as you defined wrong gateway

In your server block you defined
fastcgi_pass unix:/tmp/php5-fpm.depressed.sock;

But in your php5-fpm pool you defined
listen = /tmp/php5-fpm.mysuperbigsite.sock

504 Gateway Timeout:


#3