2015-05-20, 10:31 AM
I have a VPS that I have Wordpress running on that I want to remain using htpcguides.com. I am trying to make mybb be in htpcguides.com/forum but for the life of me I cannot get it to work. If anybody has this working can you please share your vhost configuration?
Without trying to use /forum as the custom location this configuration works beautifully, when I try to make the adjustments as shown below, I can point to htpcguides.com/forum/install and it downloads the php file instead of executing it, if I remove the /forum bits it works just fine.
Without trying to use /forum as the custom location this configuration works beautifully, when I try to make the adjustments as shown below, I can point to htpcguides.com/forum/install and it downloads the php file instead of executing it, if I remove the /forum bits it works just fine.
server {
listen 80;
server_name default_server;
root /var/www/mybb;
access_log /var/log/nginx/forum.htpcguides.com.access.log;
error_log /var/log/nginx/forum.htpcguides.com.error.log;
location /forum {
server_tokens off;
index index.html index.htm index.php;
rewrite ^/forum/forum-([0-9]+)\.html$ /forumdisplay.php?fid=$1;
rewrite ^/forum/forum-([0-9]+)-page-([0-9]+)\.html$ /forumdisplay.php?fid=$1&page=$2;
rewrite ^/forum/thread-([0-9]+)\.html$ /showthread.php?tid=$1;
rewrite ^/forum/thread-([0-9]+)-page-([0-9]+)\.html$ /showthread.php?tid=$1&page=$2;
rewrite ^/forum/thread-([0-9]+)-lastpost\.html$ /showthread.php?tid=$1&action=lastpost;
rewrite ^/forum/thread-([0-9]+)-nextnewest\.html$ /showthread.php?tid=$1&action=nextnewest;
rewrite ^/forum/thread-([0-9]+)-nextoldest\.html$ /showthread.php?tid=$1&action=nextoldest;
rewrite ^/forum/thread-([0-9]+)-newpost\.html$ /showthread.php?tid=$1&action=newpost;
rewrite ^/forum/thread-([0-9]+)-post-([0-9]+)\.html$ /showthread.php?tid=$1&pid=$2;
rewrite ^/forum/post-([0-9]+)\.html$ /showthread.php?pid=$1;
rewrite ^/forum/announcement-([0-9]+)\.html$ /announcements.php?aid=$1;
rewrite ^/forum/user-([0-9]+)\.html$ /member.php?action=profile&uid=$1;
rewrite ^/forum/calendar-([0-9]+)\.html$ /calendar.php?calendar=$1;
rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)\.html$ /calendar.php?action=yearview&calendar=$1&year=$2;
rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)\.html$ /calendar.php?calendar=$1&year=$2&month=$3;
rewrite ^/forum/calendar-([0-9]+)-year-([0-9]+)-month-([0-9]+)-day-([0-9]+)\.html$ /calendar.php?action=dayview&calendar=$1&year=$2&month=$3&day=$4;
rewrite ^/forum/calendar-([0-9]+)-week-(n?[0-9]+)\.html$ /calendar.php?action=weekview&calendar=$1&week=$2;
rewrite ^/forum/event-([0-9]+)\.html$ /calendar.php?action=event&eid=$1;
rewrite ^/forum/archive/index.php/forum-([0-9]+)\.html$ /forum/archive/index.php?forum-$1.html;
rewrite ^/forum/archive/index.php/thread-([0-9]+)\.html$ /forum/archive/index.php?thread-$1.html;
}
location ~ /forum/(inc|uploads/avatars) {
deny all;
}
location ~* \.(jpg|jpeg|gif|png|css|ico|xml)$ {
access_log off;
log_not_found off;
expires 360d;
}
location ~ /forum/+.\.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/mybb/$fastcgi_script_name;
}
location ~ /\.ht {
deny all;
}
}