Archive For: March, 2015

Setup XenForo locally for learning and Development

Good way for XenForo users who want to install XenForo locally for learning and development purposes. Backbone for this guide is WPN-XM (or WPИ-XM), an open source, nginx backed server stack for Windows actively developed by Jens-André Koch. You can donate to him here.
Compatible with XenForo Versions 1.0, 1.1, 1.2, 1.3, 1.4
Homepage: http://wpn-xm.org/
Github: https://github.com/WPN-XM

1. Download and install WPN-XM

Go to http://wpn-xm.org/ and grab the All-In-One Installer. Webinstaller is buggy and doesn’t always work. Next, install it in any directory you like. When it prompts you to select the components you want to install, follow this picture as you don’t need all of them:
wpnsetup

 

 

 

 

 

 

 

For the next prompt, choose if you want start menu entries, desktop shortcuts etc.
I’d choose the portable installation because it doesn’t do registry entries and makes for a clean uninstall.

wpnsetup2

 

 

 

 

 

When the installation completes;

2. Create database and copy XenForo

Run WPN-XM. You should see the Server Control Panel:

server conrolpanel

 

 

 

 

Click the Start button and the grey dots to the left should turn green.

wpnpanel2

 

 

 

 

Now click the webinterface button to reach the Webinterface:

wpnwebinterface

 

 

 

To create a database for XenForo, click at phpmyadmin. Username is “root”. Leave the password field blank. phpmyadmin will create a database with the collation utf8_general_ci. Name your database and when its created, click at the red Stop button from the Server Control Panel.

Navigate to the www folder of WPN-XM and create the folders for your project. .In the one for the XenForo install unzip the XenForo archive.

3. Configuring php

You need to follow the instructions carefully. First navigate to /bin/php/ and open the php.ini with the editor of your choice. There we need to make a few adjustments.

Find post_max_size and upload_max_filesize and set their values to 80M. As this is for development purposes, you’ll likely have to import and export databases if something blows up or if an add-on creates database entries that you can’t get rid of during the uninstall process. This is the first step to allow importing databases bigger than the default allowed size (8MB).

Save the changes, navigate to /bin/nginx/conf/ and open nginx.conf. We need to make changes there as well. The first thing to do is copy&paste the following line directly below http {

Code:
server_names_hash_bucket_size 128;

What does this do? By default you can access your local xenforo installation via the following URL: http://localhost/xf/

/xf/ is the folder I chose for the xenforo installation in this guide. Now it’s possible to use any domain name you want instead of localhost by setting up a virtual host (this is described later). The problem is, if your domain name is too long, you get a Gateway time-out error. The setting above allows you to use a long domain name.

Now find client_max_body_size and change its value to 80M. This will complete the permission to import databases up to 80MB big.

At this point if you were to install xenforo and access your forum, you will see 404 errors on nearly all pages but the forum index. This is because we haven’t defined rewrite rules yet.

Find

Code:

# handle files in the root path /www

location / {

index index.php index.html index.htm;

}

and replace it with

Code:

# handle files in the root path /www

location / {

index index.php index.html index.htm;

}

 

location /xf {

try_files $uri $uri/ /xf/index.php?$uri&$args;

index index.php index.html;

}

 

location /xf/internal_data/ {

internal;

}

location /xf/library/ {

internal;

}

The /xf/ directory must be changed to match your xenforo installation directory (if you chose something else than xf). Save the nginx.conf and start your server. Go to the webinterface of WPN-XM and click the name of your xenforo project. If all is well you should be prompted to install XenForo. Fill in all required fields and wait for completion. You know have a blazing fast XenForo forum to tinker with.

4. Setting up virtual hosts (optional)

The following step is for those who want to use a domain other than “localhost” for their forum. I will use the domain “example.com” as an example.

First open your Windows hosts file and add the following line at the end:

Code:

127.0.0.1       example.com

If this is denied you need to disable your firewall or anti-virus and re-enable them again.

Now open the nginx.conf file and delete the lines you previously added:

Code:

location /xf {

try_files $uri $uri/ /xf/index.php?$uri&$args;

index index.php index.html;

}

 

location /xf/internal_data/ {

internal;

}

location /xf/library/ {

internal;

}

Save the nginx.conf and navigate to /bin/nginx/conf/domains-enabled/ and create a new file called xenforo.conf. Open the file and copy&paste the following into it:

Code:

server {

listen   127.0.0.1:80;

server_name example.com;

 

root www/xf;

index index.php index.html;

 

log_not_found off;

charset utf-8;

 

access_log logs/xf.access.log main;

 

location / {

try_files $uri $uri/ /index.php?$uri&$args;

index index.php index.html;

}

 

location /internal_data/ {

internal;

}

location /library/ {

internal;

}

 

location ~ \.php$ {

try_files $uri =404;

fastcgi_pass   127.0.0.1:9100;

fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;

include         fastcgi_params;

}

}

Save and start your server. Your local xenforo site is now accessible via example.com (only for you).

 

Read More