1. 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

Discussion in 'XenForo Questions and Support' started by Andy.N, Nov 18, 2010.

  1. Andy.N

    Andy.N Well-Known Member

    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.
  2. Blandt

    Blandt Well-Known Member

    The FastCGI / Asapi issue has nothing to do with nginx.
    That's an IIS / Windows problem
  3. Vladislav Rastrusny

    Vladislav Rastrusny Active Member

    What rewrite rules are currently used there?
  4. Ahmed

    Ahmed Well-Known Member

    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.

    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.
    Darkimmortal likes this.
  5. Blandt

    Blandt Well-Known Member

    Even without the re-write rules enabled ... for some reason the CSS and JS are not delivered properly ... But let me dig up the conf files I'll post them here
  6. Blandt

    Blandt Well-Known Member

    Ok here is the one I came up with that worked flawlessely for WP but stripped xF of CSS and JS :

    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)/ {
        location ~ \.php$ {
            fastcgi_index            index.php;
            fastcgi_pass  ;
            include                /etc/nginx/fastcgi_params;
    The fastcgi_params is the plain vanilla standard nginx file
  7. Andy.N

    Andy.N Well-Known Member

    We used W3 Total Cache plugin for the Wordpress and it works great. I wonder if that plugin interferes with the redirect?
    Digital Doctor likes this.
  8. Blandt

    Blandt Well-Known Member

    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 ?
  9. Andy.N

    Andy.N Well-Known Member

    Paging Agent Blandt!
    Please report to control room. Agent Blandt ;)
  10. Blandt

    Blandt Well-Known Member

    Beta 4 fixed the issue :)

    The configuration file above works ;)
    Andy.N likes this.
  11. Andy.N

    Andy.N Well-Known Member

    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 ;)
  12. Blandt

    Blandt Well-Known Member

    As I suspected before .. it fixed IIS issue too .. I think Mike says something about magic quotes ... not sure :)
  13. SneakyDave

    SneakyDave Well-Known Member

    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.

    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_index index.php;
            fastcgi_param  SCRIPT_FILENAME  /home/user/public_html/xxxx.yyy/public/community$fastcgi_script_name;
  14. Blandt

    Blandt Well-Known Member

    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 likes this.
  15. Andy.N

    Andy.N Well-Known Member

    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.
    Blandt likes this.
  16. bubbl3

    bubbl3 Active Member

    Did you ever solve the ACP access problem?

Share This Page