• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Who is running Xenforo + Wordpress +Nginx

Andy.N

Well-known member
#1
So Blandt and I have been trying to get this particular setup working for over a month or so without success.
Here is our setting
Server runs nginx latest build
Main site runs latest WP installed on www.domain.com
Forum runs the beta 3 Xenforo on www.domain.com/forum/

When we set up this way, Wordpress works as expected but Xenforo will not show images/css/javascript/ regardless of how we try to set it in nginx config file.

We contacted the author of nginx, tested, retested but all things point to XF. The problem appears to be that Xenforo is not working with fastcgi, only asapi.

I hope we are not the only people who have this particular setup. Since nginx and Wordpress have been around for long, hopefully someone running this can jump in and offer input.

Blandt is betting that I won't find anyone out there running this.
 

Ahmed

Well-known member
#4
I use Nginx as a front-end and it works just fine as Apache handles all PHP stuff.
You may want to consider using Nginx with PHP-FPM.

Edit:
I forgot to say that I currently can't use User-Friendly URL system as I get broken thread URLs and can't even log to the ACP, but I didn't look much into it and I think there will be some way to get around this issue.
 

Blandt

Well-known member
#6
Ok here is the one I came up with that worked flawlessely for WP but stripped xF of CSS and JS :

HTML:
location /     {

    set $totalcache_file '';
    set $totalcache_uri $request_uri;

    if ($request_method = POST) {
      set $totalcache_uri '';
        }

    if ($query_string) {
      set $totalcache_uri '';
    }

    if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_" ) {
      set $totalcache_uri '';
    }

    if ($totalcache_uri ~ ^(.+)$) {
      set $totalcache_file /wp-content/w3tc-$http_host/pgcache/$1/_default_.html;
    }

    if (-f $document_root$totalcache_file) {
      rewrite ^(.*)$ $totalcache_file break;
    }

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

    gzip  on;

               gzip_vary on;
               gzip_comp_level 3;
               gzip_proxied any;
               gzip_types text/plain text/html text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
               gzip_buffers 16 8k;

    location /forum/ {
        try_files            $uri $uri/ /forum/index.php?$uri&$args;
    }

    location /forum/(data|internal_data|library)/ {

    internal;
    }

    location ~ \.php$ {
        fastcgi_index            index.php;
        fastcgi_pass            127.0.0.1:9000;
        include                /etc/nginx/fastcgi_params;

}
The fastcgi_params is the plain vanilla standard nginx file
 

Blandt

Well-known member
#8
I should Also mention that I have moved the gzip directive down/up and in every possible block combination ..... to no avail :D ...

But then it was brought to my attention that nginx keeps cache ... so my changes could have been not implemented immediately
Any thoughts ?
 

Blandt

Well-known member
#12
The piece of news we have been waiting for since beta 1.

Now we need to get an idea of what exactly fixed it so we can nail it down for good ;)
As I suspected before .. it fixed IIS issue too .. I think Mike says something about magic quotes ... not sure :)
 

SneakyDave

Well-known member
#13
Have you tried your nginx configuration as a subdomain? I have a working nginx configuration that works at the directory level, but once I try to change it to a subdomain, IE gives an not found error when anybody logs out as a member. Can't reproduce it in other browsers, and all the other functionality seems to work.

I'm using this type of configuration, this works for me, except when I try to log out with IE.

Code:
server {
    listen   80;
    server_name community.xxxx.yyy;

    access_log  /home/user/public_html/xxxx.yyy/log/access.log;
    error_log     /home/user/public_html/xxxx.yyy/log/error.log;

        location ~* ^.+\.(jpe?g|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|swf|avi|mp3)$ {
            expires max;
            root   /home/user/public_html/xxxx.yyy/public/community;
        }
   
    location / {
        root   /home/user/public_html/xxxx.yyy/public/community;
        index  index.html index.htm index.php;
        if (!-e $request_filename) {
             rewrite ^(.*)$ /index.php last;
        }
    }

    location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param  SCRIPT_FILENAME  /home/user/public_html/xxxx.yyy/public/community$fastcgi_script_name;
    }

}
 

Blandt

Well-known member
#14
haha my reply is a little late but ... Mr boss doesn't like the subdomain solution, which it worked and I had suggested :D it's fixed now since beta 4 ;)

PS: catching up on old posts :D :D
 

Andy.N

Well-known member
#15
haha my reply is a little late but ... Mr boss doesn't like the subdomain solution, which it worked and I had suggested :D it's fixed now since beta 4 ;)

PS: catching up on old posts :D :D
Better late than never, blandt

Just to let everyone know that we are happy ever after running on a brand new server using nginx+wordpress+XF.

Blandt has helped a lot in convincing me that nginx is worth all the trouble and I'm glad I took a leap of faith.
 

bubbl3

Active member
#16
I use Nginx as a front-end and it works just fine as Apache handles all PHP stuff.
You may want to consider using Nginx with PHP-FPM.

Edit:
I forgot to say that I currently can't use User-Friendly URL system as I get broken thread URLs and can't even log to the ACP, but I didn't look much into it and I think there will be some way to get around this issue.
Did you ever solve the ACP access problem?