欢迎来到云服务器

服务器租用

Nginx虚拟主机配置

      在以下是示例中,配置了三个虚拟主机,第一个虚拟主机表示所有对域名 aaa.domain.com 的访问都由它来处理,第二个虚拟主机表示所有对域名 bbb.otherdomain.com 的访问都由它来处理,第三个虚拟主机表示对域名 www.domain.com、domain.com,以及除了 aaa.domain.com 之外的所有 *.domain.com 二级域名的访问都由它来处理。每个虚拟主机的网页文件分别存放在不同的目录中,每个虚拟主机使用了不同的日志文件来记录访问日志。

---------------------------------------------------------------------------------------------------------------------
http
{
    # 第一个虚拟主机
    server
    {
        # 监听的端口
        listen        80;

        # 主机名称
        server_name    aaa.domain.com;

        # 访问日志文件存放路径
        access_log    logs/aaa.domain.com.access.log    combined;

        location /
        {
            # 默认首页文件,顺序从左到右,如果找不到index.html文件,则查找index.htm文件作为首页文件,以此类推
            index    index.html index.htm index.php;

            # HTML网页文件的存放目录
            root    /data0/htdocs/aaa.domain.com;
        }
    }

    # 第二个虚拟主机
    server
    {
        # 监听的端口
        listen        80;

        # 主机名称
        server_name    bbb.otherdomain.com;

        # 访问日志文件存放路径
        access_log    logs/bbb.otherdomain.com.access.log    combined;

        location /
        {
            # 默认首页文件,顺序从左到右,如果找不到index.html文件,则查找index.htm文件作为首页文件,以此类推
            index    index.html index.htm index.php;

            # HTML网页文件的存放目录
            root    /data0/htdocs/bbb.otherdomain.com;
        }
    }

    # 第三个虚拟主机
    server
    {
        # 监听的端口
        listen        80;

        # 主机名称
        server_name    www.domain.com domain.com *.domain.com;

        # 访问日志文件存放路径
        access_log    logs/bbb.domain.com.access.log    combined;

        location /
        {
            # 默认首页文件,顺序从左到右,如果找不到index.html文件,则查找index.htm文件作为首页文件,以此类推
            index    index.html index.htm index.php;

            # HTML网页文件的存放目录
            root    /data0/htdocs/domain.com;
        }
    }
}

腾讯云代理

Copyright © 2003-2021 MFISP.COM. 国外vps服务器租用 梦飞云服务器租用 版权所有 粤ICP备11019662号

可以介绍下你们的服务器产品么

云服务器你们是怎么收费的呢

租用vps现在有优惠活动吗