April 15, 2015 12:58PM
I have a vbulletin site in root and a wordpress blog in /blog/

the root nginx rewrites all work as they should utilising the dbseo plugin for vbulletin to make search engine friendly urls

if i turn on permalinks in wordpress i get a 404 error no matter what i try.

Could anyone advise what the change should be to be able to use a different set of rewrite rules in just the blog folder.

I am hoping to have other wordpress installs for different purposes so this will hopefully explain for the future also.

Current domain.conf for nginx

server {
listen 80;
#listen [::]:80 default ipv6only=on;

root /home/username/domains/;
access_log /home/username/domains/;
error_log /home/username/domains/;

index index.php index.html index.htm;
error_page 404 /404.html;

location / {
try_files $uri $uri/ /dbseo.php;

location ~ ^((?!dbseo).)*\.php$
rewrite ^/(.*)$ /dbseo.php last;

# Pass PHP scripts to PHP-FPM
location ~ \.php$ {
try_files $uri =403;
fastcgi_split_path_info ^(/blog)(/.*)$;
fastcgi_pass unix:/var/run/php5-fpm-username.sock;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

# Enable browser cache for CSS / JS
location ~* \.(?:css|js)$ {
expires 30d;
add_header Pragma "public";
add_header Cache-Control "public";
add_header Vary "Accept-Encoding";

# Enable browser cache for static files
location ~* \.(?:ico|jpg|jpeg|gif|png|bmp|webp|tiff|svg|svgz|pdf|mp3|flac|ogg|mid|midi|wav|mp4|webm|mkv|og$
expires 60d;
add_header Pragma "public";
add_header Cache-Control "public";

# Deny access to hidden files
location ~ (^|/)\. {
deny all;

# Prevent logging of favicon and robot request errors
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; }

I have tried a load of different options to get this to work.

I have posted these on stackoverflow which is possibly simpler than posting again here.
thats here

Any help w2ould be most appreciated.

I think i just need the basics of how to ignore / include certain rules for certain pages.

how do i make /blog/ only use its own rules and ignore everything else.?
Subject Author Posted

Nginx config for wordpress in subfolder with rewrites for main folder

sip April 15, 2015 12:58PM

Re: Nginx config for wordpress in subfolder with rewrites for main folder

itpp2012 April 15, 2015 01:17PM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 48
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready