View Single Post
Old 06-28-2017, 01:32 PM  
EddyTheDog
Just Doing My Own Thing
 
EddyTheDog's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 25,040
Quote:
Originally Posted by Zverka View Post
First thing before accusing ngigx rewrite rules I would first check hardcoded stage site urls, I have seen this almost everyday. Developers sometimes use absolute urls instead of relative, and those are hardcoded either in database or in php somewhere.

This what you described it looks like what I think is, hardcoded absolute urls.

2 places to check:

1) database, dump database as .sql and opens in any txt editor, try to find stage site urls, it there are beta.example.com replace it with example

2) code, search entire public_html and try to find beta.example hardcoded in php

Lastly if this what I described is true, dump those developers ...

After this check you could proceed to nginx. This is my wp nginx that works for years

server {

listen 80;
server_name example.com;

root /home/sites/example.com/public_html;
access_log /home/sites/example.com/logs/access.log;
error_log /home/sites/example.com/logs/error.log;

location / {
index index.html index.htm index.php;
include /home/sites/example.com/public_html/nginx.conf;
}

location = /xmlrpc.php {
deny all;
#access_log off; #to prevent from filling up the access log file
#error_log off; #to prevent from filling up the error log file
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm-sites.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)(\?ver=[0-9.]+)?$ {
expires 1y;
log_not_found off;
}

}

server {

listen 80;
server_name www.example.com;

root /home/sites/example.com/public_html;
access_log /home/sites/example.com/logs/access.log;
error_log /home/sites/example.com/logs/error.log;

location / {
index index.html index.htm index.php;
include /home/sites/example.com/public_html/nginx.conf;
}

location = /xmlrpc.php {
deny all;
#access_log off; #to prevent from filling up the access log file
#error_log off; #to prevent from filling up the error log file
}

location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass unix:/var/run/php5-fpm-sites.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

location ~* \.(js|css|png|jpg|jpeg|gif|ico)(\?ver=[0-9.]+)?$ {
expires 1y;
log_not_found off;
}

}

make sure server paths match yours.

And this is nginx.conf for wp pretty links rewrite, notice include it above conf

location / {
index index.html index.htm index.php;
include /home/sites/example.com/public_html/nginx.conf;
}

so this is nginx.conf

rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;

#if (!-e $request_filename) {
#rewrite ^(.+)$ /index.php?q=$1 last;
#}

if (!-e $request_filename) {
rewrite . /index.php last;
}


commented part

#if (!-e $request_filename) {
#rewrite ^(.+)$ /index.php?q=$1 last;
#}

was original I found for wp but somehow this one below works better on my server.
Sounds about right - I would try this first...
__________________
-

Chaturbate Script - https://gfy.com/fucking-around-and-b...er-issues.html - Now supports White Labels
EddyTheDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote