All of Contact Form Plugins are Working Extremely Slow

enter image description here

I installed WordPress multisite on LEMP. php 7.2 – Nginx/Ubuntu 18.04.

Any contact form plugin wasn’t working because of the 504 gateway error. Now those plugins are working with the increased timeout value. However it is extremely slow. When I try to send test email on my contact form, it is very very slow. Although the test email is arrived me, it takes long time.

This is response time of the contact form that is recorded by my browser.

Also I’m using Cloudflare cache everything rule.

This is nginx.conf:

server {
root /var/www/html;
index index.php index.html index.htm;
server_name example.net www.example.net;

# REMOVE THIS AFTER PUBLISING BLOG
add_header  X-Robots-Tag "noindex, nofollow, nosnippet, noarchive";

# Add support for subdirectory structure in WordPress Multisite
if (!-e $request_filename) {
    rewrite /wp-admin$ $scheme://$host$uri/ permanent;	
    rewrite ^(/[^/]+)?(/wp-.*) $2 last;                     
    rewrite ^(/[^/]+)?(/.*.php) $2 last;                   
}

# W3 Total Cache Plugin
include /var/www/html/nginx.conf;
location = /nginx.conf {
deny all;
}

# Deny access to uploads that aren't images, videos, music, etc.
location ~* ^/wp-content/uploads/.*.(html|htm|shtml|php|js|swf)$ {
    deny all;
}

# Deny public access to wp-config.php
location ~* wp-config.php {
    deny all;
}

# Block access to xmlrpc.php
location = /xmlrpc.php {
	deny all;
	access_log off;
	log_not_found off;
}

# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /. {
	deny all;
}

error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

location / {
try_files $uri $uri/ /index.php?q=$uri&$args;
}

location ~* .php$ {
if ($uri !~ "^/uploads/") {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_read_timeout 300; #I added this line because of the 504 gateway errors.
}


location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
log_not_found off;
access_log off;
allow all;
}

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/example.net/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/example.net/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot


}

server {
    if ($host = www.example.net) {
        return 301 https://example.net$request_uri;
    } # managed by Certbot


    if ($host = example.net) {
        return 301 https://example.net$request_uri;
    } # managed by Certbot

listen 80;
server_name example.net www.example.net;
    return 404; # managed by Certbot



}

I found this on the Google search. Looks like the same issue with me.
I couldn’t fix it for 3 months. I tried every way to fix it. Could you please help me!

Read more here:: All of Contact Form Plugins are Working Extremely Slow

Leave a Reply

Your email address will not be published. Required fields are marked *