XenForo in a Subdirectory (Nginx)

As an alternative to installing a forum using a subdomain, let’s get it set up in a subdirectory.


For one of my recent projects, I needed to use WordPress and XenForo — with WordPress sitting at the root and XenForo in a subdirectory called community. Here’s the config file that I used to successfully install XenForo in a subdirectory. It’s really simple.

	##							        ##
	# Subdirectory for XenForo           #
	##							        ##
	location /community {
		try_files $uri $uri/ /community/index.php?$uri&$args;
		index index.php index.html;
	location /community/(internal_data|library)/(.*)$ {

All you need to do is get that pasted into the Server block of your WordPress Nginx config and you’ll be good to go! Note that I left off the trailing slash in the location directive. That will allow you to access the subdirectory whether it’s linked as domain.com/community or domain.com/community/.