Hi,
the link is directing to the production site. Did you already remove the staging site?
Hi, no I didn’t remove it, because I was waiting for your reply.
Yes. For some strange reason it’s redirecting to the production site.
However if I go to https://www.anahatatantra.com/staging/ I see the staging site.
But when I try to click on pages or posts that have /staging/ in the URL, they redirect to the production site.
I think this is an additional problem that happened while waiting for your reply…
Your nginx.conf looks unusual. You have two server blocks listening to port 443. The first block is redirecting all links. This could be part of the reason: http://take.ms/Bihxq
I do not know such a variant, only using one server block per port.
Anyways, the correct block for your php version config should be:
location /staging{
root /var/www/html/staging/;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SERVER_NAME $host;
include fastcgi_params;
}
}
You do not use php 7.1.
Before you use that configuration use nginx -t
command from bash to check the nginx.conf for syntax errors.
Hi, the two servers blocks are correct because the first one redirects, using https, all the requests non-www to www.
This is the same job that wordpress does, however nginx is much faster than PHP and it’s better if done in the server not via PHP.
The problem comes later. Now, I added the code you provided above, and as you can see I get 404 errors:
2018/10/16 06:00:06 [error] 29253#0: *83130 "/var/www/html/staging/staging/index.php" is not found (2: No such file or directory), client: 89.65.64.196, server: www.anahatatantra.com, request: "GET /staging/ HTTP/1.1", host: "www.anahatatantra.com"
/staging/staging/ is appearing this way… like double
Is that path correct for your website?
root /var/www/html/staging/;
Can you show me the entire nginx.conf for your site including that modification?
Please send it to support [at] wp-staging.com and do not post it to pastebin due to security purposes. You should also delete your old file there.
The production site is at
/var/www/anahatatantra.com
the staging files are at
/var/www/html/staging/
So I suppose I have to change
/var/www/html/staging/
to
/var/www/anahatatantra.com/staging/
I just changed it and the error is still 404:
2018/10/16 06:29:01 [error] 29512#0: *83946 "/var/www/anahatatantra.com/staging/staging/index.php" is not found (2: No such file or directory), client: 89.65.64.196, server: www.anahatatantra.com, request: "GET /staging/ HTTP/1.1", host: "www.anahatatantra.com"
I updated the nginx config:
the ngixn config:
https://pastebin.com/2FEtTgzT
I think I had something missing in my answer. Please try that code. Is it working?
location /staging {
try_files $uri $uri/ /staging/index.php?q=$request_uri;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SERVER_NAME $host;
include fastcgi_params;
}
}
Yeah, thank you. This is working fine. You can test it.
Now the problem seem to be that when the user clicks the flag to change the language, while in AMP, the user gets redirected to the non-amp page of the other language