哥呀,这个怎么用

问答中心分类: OneinStack哥呀,这个怎么用
匿名用户 asked 9 年 ago
别人的域名解析到了我的独立IP上怎么办?
Posted by Li Side on 17 June 2014 02:22 AM
因为使用的是独立IP,所以别人也可以把域名解析到该ip上,这个是域名所有者操作的,我们这边是控制不了的,就像你可以把你的域名解析到任意一个IP上去。
用下面这个rewrite规则可以让解析过来的域名都转向自己的域名:
RewriteEngine On RewriteCond %{HTTP_HOST} !(^www\.yourdomain\.com$) [NC] RewriteRule ^(.)$ http://www.yourdomain.com/$1 [L,R=301]
这样如果对方继续解析,流量也都转向了自己的域名,对对方无益了。
http://www.cycy6.com.conf里是这些
server {
listen 80;
server_name http://www.nowxiu.com nowxiu.com;
access_log off;
index index.html index.htm index.php;
error_page 404 500 502 503 504 = /404.html;
include /usr/local/nginx/conf/discuz.conf;
root /data/wwwroot/www.nowxiu.com;
if ($host != http://www.nowxiu.com) {
rewrite ^/(.*)$ $scheme://www.nowxiu.com/$1 permanent;
}
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
}
discuz.conf里是这些
rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/blog-([0-9]+)-([0-9]+)\.html$ $1/home.php?mod=space&uid=$2&do=blog&id=$3 last;
rewrite ^([^\.]*)/(fid|tid)-([0-9]+)\.html$ $1/index.php?action=$2&value=$3 last;
rewrite ^([^\.]*)/([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ $1/plugin.php?id=$2:$3 last;
#if (!-e $request_filename) {
# return 404;
#}
我要把那句加哪个里,怎么加,加哪啊
 
 

1 Answers
oneinstack answered 9 年 ago
建议用./vhost.sh 绑定域名 ,且自带discuz规则 ,你可以把公网IP也绑定,并设置301跳转即可