Nginx Rewrites for vBulletin vBSEO
Notes: For vB 4.2.x, edit php.ini (phpedit) and remove exec,passthru,shell_exec,system from disabled_functions, leaving just proc_open,popen. Restart php-fpm (fpmrestart).
Email Note: For vBulletin 4.2, in AdminCP → Options → Email set: Enable -f parameter = yes, Use Cron Based Sending = no.
Where vBulletin 4.2.1 is installed at /vb421:
location /vb421/ {{
rewrite ^/vb421/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /vb421/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
try_files $uri $uri/ /vb421/vbseo.php?$args;
}}
location /vb421/includes {{
allow 127.0.0.1;
deny all;
}}
location /vb421/packages {{
allow 127.0.0.1;
deny all;
}}
location /vb421/vb {{
allow 127.0.0.1;
deny all;
}}
location /vb421/admincp {{
include /usr/local/nginx/conf/php.conf;
#auth_basic "Private";
#auth_basic_user_file /usr/local/nginx/conf/htpasswd;
}}
location /vb421/vbseo/(includes|resources/html|resources/xml)/ {{
allow 127.0.0.1;
deny all;
}}
location ~ /vb421/(.*\.php)$ {{
rewrite ^/vb421/(.*)$ /vb421/vbseo.php last;
}}
Full Nginx Vhost Example
server {{
listen 80 default_server;
server_name localhost;
root html;
access_log /var/log/nginx/localhost.access.log main buffer=32k;
error_log /var/log/nginx/localhost.error.log error;
location / {{
autoindex on;
}}
include /usr/local/nginx/conf/staticfiles.conf;
include /usr/local/nginx/conf/php.conf;
include /usr/local/nginx/conf/drop.conf;
location /vb421/ {{
rewrite ^/vb421/((urllist|sitemap_).*\.(xml|txt)(\.gz)?)$ /vb421/vbseo_sitemap/vbseo_getsitemap.php?sitemap=$1 last;
try_files $uri $uri/ /vb421/vbseo.php?$args;
}}
location /vb421/includes {{ allow 127.0.0.1; deny all; }}
location /vb421/packages {{ allow 127.0.0.1; deny all; }}
location /vb421/vb {{ allow 127.0.0.1; deny all; }}
location /vb421/admincp {{
include /usr/local/nginx/conf/php.conf;
#auth_basic "Private";
#auth_basic_user_file /usr/local/nginx/conf/htpasswd;
}}
location /vb421/vbseo/(includes|resources/html|resources/xml)/ {{
allow 127.0.0.1;
deny all;
}}
location ~ /vb421/(.*\.php)$ {{
rewrite ^/vb421/(.*)$ /vb421/vbseo.php last;
}}
}}
Restart Nginx: service nginx restart or shortcut ngxrestart
Password Protecting AdminCP
Use HttpAuthBasicModule with the included htpasswd.py tool:
python /usr/local/nginx/conf/htpasswd.py -c -b /usr/local/nginx/conf/htpasswd username password
Then uncomment the auth_basic lines in the admincp location block and restart Nginx.
ImageMagick Notes
For vB to work with ImageMagick: edit php.ini (phpedit), remove exec from disabled_functions, set ImageMagick path to /usr/bin, then restart php-fpm (fpmrestart).