• 那是云首页
  • 快捷导航
  • 更多
    设为首页收藏本站
  • |

qnap 多域名主机头如何实现(非端口实现多域名多站点访问)

查看数: 1985 | 评论数: 2 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2020-2-14 15:58

正文摘要:

qnap目前只能通过不同端口来实现多站点访问(已做好ddns和路由端口映射)已实现 a.com:80---A主机站点--本地文件夹A b.com:84---B主机站点--本地文件夹B 未实现 通过同一个端口(比如81)转发到不同的站点 ...

回复

simaqiao 来自 中国四川成都 发表于 2020-2-14 16:14
qnap web服务器的 index.php


<?php
function isIPv6($ip)
{
        if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) === false) {
                return true;
        }
        return false;
}
function isMyCloudNAS()
{
        if (isset($_SERVER['HTTP_HOST']) && strlen($_SERVER['HTTP_HOST']) > 0)
                $_http_host = $_SERVER['HTTP_HOST'];
        else
                return false;
        $mycloudnas_domains = Array(
        'mycloudnas.com',
        'myqnapnas.com',
        'qcloudnas.com',
        'myqnapcloud.com'
        );
        foreach ($mycloudnas_domains as $d)
        {
                if (strncasecmp(stristr($_http_host,$d),$d,strlen($d))==0)
                {
                        return true;
                }
        }
        return false;
}
        if(isMyCloudNAS() == true){
                $extPort = exec('/sbin/getcfg System ExtPort -d 0');
                if(intval($extPort)>0)
                        $webAccessPort = $extPort;
                else
                        $webAccessPort = exec('/sbin/getcfg System "Web Access Port" -d 8080');
        }
        else
                $webAccessPort = exec('/sbin/getcfg System "Web Access Port" -d 8080');
        $webAccessIP = $_SERVER['SERVER_NAME'];
        if($_SERVER['HTTPS'] && exec('/sbin/getcfg Stunnel Enable -d 1') == '1'){
                $protocol='https';
                $webAccessPort = exec('/sbin/getcfg Stunnel Port -d 443');
        }
        else
                $protocol='http';
        if(isIPv6($webAccessIP))
                $webAccessUrl = $protocol.'://['.$webAccessIP .']:'.$webAccessPort.'/';
        else
                $webAccessUrl = $protocol.'://'.$webAccessIP .':'.$webAccessPort.'/';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        <head>
<meta http-equiv="expires" content="0">
<script type='text/javascript'>
        location.href = '<?=$webAccessUrl?>';
</script>
        </head>
</html>
快速回复 返回列表 搜索 官方QQ群
懒人地图| 手机版|小黑屋| 智能生活 , 上那是云 |闽ICP备2020018196号-1 |网站地图