今天将Xenforo论坛从UPUPW迁移到另台机器的BT里,UPUPW的N模式其实是前端使用NGINX,后端使用Apache的方式,所以使用的伪静态还是Apache的,BT里我用的是LNMP,所以伪静态规则需要更换,这里记录一下以备日后查找。

Apache的直接使用自带的`.htaccess`文件即可。

Nginx可按以下方式写,只需修改server name, rewrite url, log & root location即可。

```php
server {
listen 80; #port
server_name www.forum.website.com;
# rewrite www, try to keep your internal linking consistent.
rewrite ^ http://forum.website.com$request_uri? permanent;
error_log /var/log/nginx/website.log warn;
root /home/srv/www/website.com/public_html/forum;
#end changes needed to begin

location / {
#This sends everything through index.php and keeps the appended query string intact.
try_files $uri $uri/ /index.php?$uri&$args;
index index.html index.htm index.php;

#gzip it, gzip it good
gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_min_length 1100;
gzip_buffers 64 8k;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript text/xml application/xml;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
}

# use fastcgi for all php files
location ~ \.php$ {
# Zero-day exploit defense.
# http://forum.nginx.org/read.php?2,88845,page=3
try_files $uri /index.php =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}

#add some expires
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 1y;
log_not_found off;
}

#protect the innocent
location ~ ^/community/(internal_data|library)/(.*)$ {
internal;
}

# deny access to apache .htaccess files
location ~ /\.ht
{
deny all;
}
}
```