Want to subscribe to topics you're interested in?
Become a Member

Xenforo Wordpress and Xenforo 2 configuration

Discussion in 'Forum software usage' started by DaB, Sep 16, 2018.

  1. DaB

    DaB New Member

    19
    2
    3
    Aug 10, 2016
    Ratings:
    +2
    Local Time:
    10:54 AM
    Current
    Current
    I have WordPress install in the root directly with friendly URL's working.

    I have installed Xenforo 2 into /domain.com/community

    I want to enable friendly URL's for Xenforo but I am worried about messing up the configuration for WordPress.

    Am I right in saying I need to edit the following file to get friendly URL's working?

    /usr/local/nginx/conf/conf.d/domain.com.ssl.conf

    Thanks!
     
  2. eva2000

    eva2000 Administrator Staff Member

    36,054
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    7:54 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
  3. DaB

    DaB New Member

    19
    2
    3
    Aug 10, 2016
    Ratings:
    +2
    Local Time:
    10:54 AM
    Current
    Current
    I get this aerror when I add the code from the Xenforo site....

    Restarting nginx (via systemctl): Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" an d "journalctl -xe" for details.
    [FAILED]
     
  4. eva2000

    eva2000 Administrator Staff Member

    36,054
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    7:54 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    try nginx config test via command and show what output is shown
    Code (Text):
    nginx -t
    

    for posting code or output from commands to keep the formatting, you might want to use CODE tags for code How to use forum BBCODE code tags :)
     
  5. DaB

    DaB New Member

    19
    2
    3
    Aug 10, 2016
    Ratings:
    +2
    Local Time:
    10:54 AM
    Current
    Current
    Code:
    nginx: [emerg] "location" directive is not allowed here in /usr/local/nginx/conf/conf.d/yourdomain.com.ssl.conf:148
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    
    Here we go.....
     
    Last edited by a moderator: Sep 17, 2018 at 9:21 AM
  6. eva2000

    eva2000 Administrator Staff Member

    36,054
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    7:54 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    contents of /usr/local/nginx/conf/conf.d/yourdomain.com.ssl.conf ? you can use cat command to spit out contents to your SSH session window and do a copy and paste
    Code (Text):
    cat /usr/local/nginx/conf/conf.d/yourdomain.com.ssl.conf
    

    you can do a search and replace to mask your actual domain name and replace with dummy yourdomain.com too
     
  7. DaB

    DaB New Member

    19
    2
    3
    Aug 10, 2016
    Ratings:
    +2
    Local Time:
    10:54 AM
    Current
    Current
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name mydomain.com.com www.mydomain.com.com;
    #            return 301 $scheme://www.mydomain.com.com$request_uri;
    #       }
    
    server {
     
      server_name mydomain.com.com www.mydomain.com.com;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/mydomain.com.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/mydomain.com.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/mydomain.com.com/autoprotect-mydomain.com.com.conf;
      root /home/nginx/domains/mydomain.com.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      #include /usr/local/nginx/conf/wpincludes/mydomain.com.com/wpcacheenabler_mydomain.com.com.conf;
      include /usr/local/nginx/conf/wpincludes/mydomain.com.com/wpsupercache_mydomain.com.com.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/mydomain.com.com/rediscache_mydomain.com.com.conf; 
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
     
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      #try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args; 
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
       # auth_basic "Private";
       # auth_basic_user_file /home/nginx/domains/mydomain.com.com/htpasswd_wplogin;   
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /wp-admin/(load-scripts\.php) {
        limit_req zone=xwprpc burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /wp-admin/(load-styles\.php) {
        limit_req zone=xwprpc burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      include /usr/local/nginx/conf/wpincludes/mydomain.com.com/wpsecure_mydomain.com.com.conf;
      include /usr/local/nginx/conf/php-wpsc.conf;
     
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/pre-staticfiles-local-mydomain.com.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
     
      location /community/ {
        try_files $uri $uri/ /community/index.php?$uri&$args;
        index index.php index.html;
    }
    
    location /community/install/data/ {
        internal;
    }
    location /community/install/templates/ {
        internal;
    }
    location /community/internal_data/ {
        internal;
    }
    location /community/library/ { #legacy
        internal;
    }
    location /community/src/ {
        internal;
    }
    
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass    127.0.0.1:9000;
        fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include         fastcgi_params;
    }
    
     
  8. eva2000

    eva2000 Administrator Staff Member

    36,054
    7,910
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,192
    Local Time:
    7:54 PM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    you had xenforo rules outside of server{} context and probably need something like below removing the php context which can be done with php.conf include file
    Code (Text):
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name mydomain.com.com www.mydomain.com.com;
    #            return 301 $scheme://www.mydomain.com.com$request_uri;
    #       }
    
    server {
    
      server_name mydomain.com.com www.mydomain.com.com;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #add_header Referrer-Policy "strict-origin-when-cross-origin";
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/mydomain.com.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/mydomain.com.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/mydomain.com.com/autoprotect-mydomain.com.com.conf;
      root /home/nginx/domains/mydomain.com.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      #include /usr/local/nginx/conf/wpincludes/mydomain.com.com/wpcacheenabler_mydomain.com.com.conf;
      include /usr/local/nginx/conf/wpincludes/mydomain.com.com/wpsupercache_mydomain.com.com.conf;
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/wpincludes/mydomain.com.com/rediscache_mydomain.com.com.conf;
     
      include /usr/local/nginx/conf/wpincludes/mydomain.com.com/wpsecure_mydomain.com.com.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # for wordpress super cache plugin
      try_files /wp-content/cache/supercache/$http_host/$cache_uri/index.html $uri $uri/ /index.php?q=$uri&$args;
    
      # for wp cache enabler plugin
      #try_files $cache_enabler_uri $uri $uri/ $custom_subdir/index.php?$args;
    
      # Wordpress Permalinks
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      # Nginx level redis Wordpress
      # https://community.centminmod.com/posts/18828/
      #try_files $uri $uri/ /index.php?$args;
    
      }
    
    location ~* /(wp-login\.php) {
        limit_req zone=xwplogin burst=1 nodelay;
        #limit_conn xwpconlimit 30;
       # auth_basic "Private";
       # auth_basic_user_file /home/nginx/domains/mydomain.com.com/htpasswd_wplogin;  
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /(xmlrpc\.php) {
        limit_req zone=xwprpc burst=45 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /wp-admin/(load-scripts\.php) {
        limit_req zone=xwprpc burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
    location ~* /wp-admin/(load-styles\.php) {
        limit_req zone=xwprpc burst=5 nodelay;
        #limit_conn xwpconlimit 30;
        include /usr/local/nginx/conf/php-wpsc.conf;
        # https://community.centminmod.com/posts/18828/
        #include /usr/local/nginx/conf/php-rediscache.conf;
    }
    
      location /community/ {
        try_files $uri $uri/ /community/index.php?$uri&$args;
        index index.php index.html;
        include /usr/local/nginx/conf/php.conf;
      }
    
      location /community/install/data/ {
          internal;
          include /usr/local/nginx/conf/php.conf;
      }
      location /community/install/templates/ {
          internal;
          include /usr/local/nginx/conf/php.conf;
      }
      location /community/internal_data/ {
          internal;
          include /usr/local/nginx/conf/php.conf;
      }
      location /community/library/ { 
          internal;
          include /usr/local/nginx/conf/php.conf;
      }
      location /community/src/ {
          internal;
          include /usr/local/nginx/conf/php.conf;
      }
    
      # https://community.centminmod.com/posts/18828/
      #include /usr/local/nginx/conf/php-rediscache.conf;
      include /usr/local/nginx/conf/pre-staticfiles-local-mydomain.com.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      #include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    
    }
    
     
..