Endless loading/spinner on the woocommerce checkout page - ajax

Since some recent updates , the checkout page on my site is not working. Even after entering name/address, the area under “Your order” is greyed out and spinning.
Things I’ve tried that didn’t work:
Disabled all plugins (except woocommerce)
Changed theme to Default theme.
Checked Woocommerce>System Status.
Increased memory limit via wp-config Disabled PayPal (the only payment gateway)
Removed the woocommerce files via admin and
uploaded a fresh version via FTP
Checked items on this page: http://docs.woothemes.com/document/endless-
loadingspinner-on-the-checkout-page/
I'm runngin NGINX 1.6.3 server and seems to be no issue with server as other woocommerce sites on same server works fine.
I’ve looked at the Chrome console and found this:
https://example.com/?wc-ajax=get_refreshed_fragments Failed to load resource: the server responded with a status of 405 (Not Allowed)
I checked using full URL like https://example.com/index.php?wc-ajax=get_refreshed_fragments and it shows some ajax code but using https://example.com/?wc-ajax=get_refreshed_fragments shows homepage.
Disabling Ajax completely on checkout page works but it does not update price for checkout addons like gift wrap.
This is config for my site:
server {
listen 80;
server_name example.com www.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl spdy;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
server_name example.com www.example.com;
root /home/user/example.com/public/;
index index.php;
access_log /home/user/example.com/logs/access.log;
error_log /home/user/example.com/logs/error.log;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ /.well-known {
allow all;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
# With php5-fpm: fastcgi_pass
#unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

Related

Nginx Server Configuration: Hostname not resolving on Subdomain

thank you in advance for your support.
I set up an Ubuntu Server with Nginx as a Digitalocean Droplet and am using the server provisioning tool Laravel Forge, which works fine. I successfully installed the PHP Framework Laravel and deployed the code on the server. I ssh into the server and checked the files in the supposed directory. The code is successfully deployed.
Next I own a domain, and created an A record for the following subdomain: app.mywebsite.de, that points to that server. I followed the digitalocean instructions and I waited the required time. Using a DNS Lookup tool, I confirmed that the subdomain actually points to the server.
Screenshot of DNS Lookup
Yet, when I use the subdomain in my browser, the browser doesn't connect to the server. I get the following error message in the browser:
Screenshot of Browser when connecting to server
It seems like the subdomain is correctly pointed to the server, but the server isn't rightly configured. I tried to check the nginx configuration and under sites-avaialble I have the following configuration for the subdomain:
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/app.mywebsite.de/before/*;
server {
listen 80;
listen [::]:80;
server_name app.mywebsite.de;
server_tokens off;
root /home/forge/app.mywebsite.de/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl_certificate;
# ssl_certificate_key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers TLS13-AES-256-GCM-SHA384:TLS13-CHACHA20-POLY1305-SHA256:TLS_AES_256_GCM_SHA384:TLS-AES-256-GCM-SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS-CHACHA20-POLY1305-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA;
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/app.mywebsite.de/server/*;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/app.mywebsite.de-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/app.mywebsite.de/after/*;
In forge-conf/app.website.de/before/*; is only one file redirect.conf with the following code:
server {
listen 80;
listen [::]:80;
server_name www.app.website.de;
if ($http_x_forwarded_proto = 'https') {
return 301 https://app.website.de$request_uri;
}
return 301 $scheme://app.website.de$request_uri;
}
There are no other sites on the server. So there is only the 000-catch-all file in the sites available directory of the nginx configuration folder.
Unfortunately I reached my limit of understanding here and I would love if somebody could point me into the right direction to find out, which part of nginx is not configured corectly.
P.S.
Some additional info:
Yes I restarted Nginx and the whole server multiple times.
Turns out, everything was configured correctly. I didn't change anything, except that I added some additional sites on the nginx server. Forge probably updated the server blocks, which resolved the problem.

Redirect from Http to https issue in NGINX Google Compute Engine

We already tried other solutions on Stack Overflow but they didn't work for us.
We are having issues while redirecting our Domain url from http to https.
When we hit the http://example.com, it is not getting redirected to https://example.com. We have also set up a Google Managed SSL in the Load Balancer in our Google Cloud Network Service.
We are using the Google Cloud Compute Engine for hosting the website and Google domains for url. Apart from that we are using the NGINX as our web server and Laravel as our framework. We also contacted the Google support team but couldn't worked.
Front and Backend Load Balancer Configuration:
PHP Framework - Laravel V8
Compute Engine - Debian 10 Buster
Below is the code for NGINX config file.
NGINX Default Config file
server
{
listen 80;
server_name example.in www.example.in;
root /var/www/html/test;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
So the below configuration really solved my issue .
I just added a new Port 80 (Http) configuration in my Front End configuration of my Load Balancer along with the Port 443 (Https) .
Now the Domain URL is getting redirected from http to https with secure connections.
Please refer to the below Screenshot of my Load Balancer Frontend Configuration .
Thank you #JohnHanley for your answer ;)
I think your NGINX configuration needs to adjust to listen on port 443 and you need to get the SSL certificate accordingly.
Please refer : https://cloud.google.com/community/tutorials/https-load-balancing-nginx.

Deployment of Laravel project on Debian 9 using nginx

I try to deploy my Laravel project from localhost to Debian server using nginx. First of all, i followed this tutorial LINK. Ended at the end of 5. chapter. I did not get any errors. Also I successfully connect Laravel project with server DB. I use Laravel version 6, so when i was modifying newly created config file on /etc/nginx/sites-available/myFile I used laravel's deployment tutorial LINK. As my server does not have any domain, I've got only IP available. Screenshot of my config file:
Config file
When I try to open server page using IP, i got error "This page isn't working". It's because i deleted nginx's default file from sites-enabled. Before, i deleted the default file, i got only default home page of nginx.
I tried to change server_name like server_name _;, server_name "";, server_name IP. After all changes i restarted nginx server.
Any help how to run my Laravel project please? Thank you!!
EDIT: route to project: /var/www/html/OciNaCeste/BP_final
Please use the following configuration
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name localhost;
root /var/www/html/OciNaCeste/BP_final/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Then restart nginx

Nginx multiple locations laravel project

I am having issues trying to setup a second set of locations for my Nginx Setup. I currently have 1 working route, that uses reverse proxy to a NodeJS Express server.
I am tryin to setup a second location to serve a laravel project, here is my Nginx config file, I know there are some errors, but after googling I coulnd't find an answer on my own.
Thanks
server {
listen 443 http2 ssl;
listen [::]:443 http2 ssl;
server_name some.server.com
ssl on;
ssl_certificate /etc/letsencrypt/live/some.server.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/some.server.com/privkey.pem;
# This doesnt work, its a laravel project
# Theres something wrong with my try_files
location /project2 {
root /home/ubuntu/project2/public/;
try_files $uri $uri/ /index.php?$query_string;
}
# This works, I am reverse proxying to NodeJS Application
location / {
proxy_pass http://localhost:3001;
proxy_set_header Host $http_host;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
You need to add something to the /project2 that tells nginx how to handle php files. a block that will know what to do with
I grabbed the following from here. I updated your location regex, though I haven't tested, so you may need to fix it (everything about nginx is trial and error until it works):
location ~* /project2/(.*\.php)$ {
root /home/ubuntu/project2/public/;
try_files $1 $1/ $1/index.php?$query_string;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
You are serving from /home/ubuntu/project2/public/, but your php urls end with project2, so you need to do a bit of regex magic to extract the proper url.
Of course, if you can make things simpler with your directory structure, you can use a simpler regex.

How To Deploy Laravel Application on Nginx Ubuntu 16.04 Server?

I want to deploy simple laravel app on nginx ubuntu 16.04 server .
I have put my app inside /var/www/html folder
on my server , i have already setup php and mysql .
i have added below code in my /etc/nginx/sites-enabled/myapp.com
server {
listen 80;
listen [::]:80;
root /var/www/html/MyApp/public;
index index.php index.html index.htm index.nginx-debian.html;
charset utf-8;
server_name myapp.com;
error_log /var/log/nginx/myapp.com.log error;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
but instead of running app , it is downloading file , so i have searched and found stackoverflow link :
Nginx serves .php files as downloads, instead of executing them
But this in Not working in my case .
I have not much idea about nginx , please help me .
nginx will show error 502 (bad gateway) when php-fpm is not running or it can't find the socket.
In your case, I think the problem is on this line:
fastcgi_pass unix:/run/php/php7.0.22-fpm.sock;
try changing it to
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
save and reload or restart nginx.

Resources