XenForo Nginx rewrite rules configuration for friendly url

[gard]
Use the following configuration file to run your XenForo forum installation delivered by the Nginx webserver with friendly urls:

The rules are very simple:

Open your nginx.conf (You often in /etc/nginx):

Inside the server block {} insert two location related sections:

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

location ~ /(internal_data|library) {
internal;
}

The first location block specifies the url rewriting process. The second location part prevents external access to the internal XenForo related data structures. Thats for security purposes of the forum installation.

If you forum is located within a subfolder like e.g. domain.com/forum or domain.com/community just add the name of the subfolder to the location parts:

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

location ~ /forum/(internal_data|library) {
internal;
}

Restart the nginx webserver.

All done. Your XenForo installation should be running fine now with search engine friendly urls like domain.com/forum/this-is-my-post.2
[gard]

Written by

"Enthusiastic Sim-Racer from the north of germany. I write here about web development, hardware, software and latest motion simulator technologies."