Welcome! Log In Create A New Profile

Advanced

Migrated custom WP site, some stuff not working

Posted by Rosewood 
Migrated custom WP site, some stuff not working
February 19, 2013 12:29PM
We have a custom WP site that we are having to migrate from Apache to nginx and while most things are working ok, some big things are not.

For example on our custom plugin our url structure looks like this: domain.com/causes-details/PERMALINK ; PERMALINK is the field we use in the db to populate the cause information. In wordpress that is just a page with no content and a special theme page.

It works fine in apache, it doesn't work at all in nginx. We get a null page.

In the root directory on the apache site there is an .htaccess file that looks like this:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

So I tossed it into a converter http://www.anilcetin.com/convert-apache-htaccess-to-nginx/ and I get

if (-e $request_filename){
set $rule_0 1;
}
if ($request_filename ~ "-l"){
set $rule_0 1;
}
if (-d $request_filename){
set $rule_0 1;
}
if ($rule_0 = "1"){
#ignored: "-" thing used or unknown variable in regex/rew
}
rewrite ^/.*$ /index.php last;

But that doesn't really fix anything on the site. So without that in there, this is what my nginx config looks like:

server {
listen 80;
root /usr/share/nginx/html/domain.com;
index index.php index.html index.htm;
server_name domain.com www.domain.com;
location / {
try_files $uri $uri/ /index.php?args;
}
location ~ /\. { access_log off; log_not_found off; deny all; }
location ~ ~$ { access_log off; log_not_found off; deny all; }
location ~ \.php$ {
try_files $uri $uri/ /index.php?args;
include fastcgi_params;
fastcgi_pass php5-fpm-sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
Re: Migrated custom WP site, some stuff not working
May 07, 2013 08:05AM
server {
listen 80;
root /usr/share/nginx/html/domain.com;
index index.php index.html index.htm;
server_name domain.com www.domain.com;

location / {
try_files $uri $uri/ /index.php$is_args$args;
}

location ~ /\. { access_log off; log_not_found off; deny all; }
location ~ ~$ { access_log off; log_not_found off; deny all; }
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass php5-fpm-sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors on;
}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 244
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready