腾讯云二级域名搭建

15 篇文章 0 订阅
2 篇文章 0 订阅

比如现在有个www.aaa.com来承载一个项目但是还想有个其他的域名(比如test.bbb.com)来承载另一个项目,也就是二级域名
首先得这样做
在这里插入图片描述
在这里像这样添加一个域名解析,添加好了后然后登陆自己的服务器,在/usr/local/nginx/conf/vhost这个位置下面添加一个test.bbb.com.conf的文件

server
    {
        listen 80;
        #listen [::]:80;
        server_name test.bbb.com ;
        index index.html index.htm index.php default.html default.htm default.php;
        root  /home/wwwroot/yii_admin/web;

        #error_page   404   /404.html;

        # Deny access to PHP files in specific directory
        #location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }

        include proxy-pass-php.conf;

        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*\.(js|css)?$
        {
            expires      12h;
        }

        location ~ /.well-known {
            allow all;
        }

        location ~ /\.
        {
            deny all;
        }

        access_log  /home/wwwlogs/test.bbb.com.log;
    }

文件内容如上
apache文件
同样在这个/usr/local/apache/conf/vhost路径下添加一个test.bbb.com.conf文件
文件内容如下

<VirtualHost *:88>
ServerAdmin webmaster@example.com
php_admin_value open_basedir "/home/wwwroot/yii_admin/:/tmp/:/var/tmp/:/proc/"
DocumentRoot "/home/wwwroot/yii_admin/web"
ServerName test.cacov.cn
ErrorLog "/home/wwwlogs/test.cacov.cn-error_log"
CustomLog "/home/wwwlogs/test.cacov.cn-access_log" combined
<Directory "/home/wwwroot/yii_admin/web">
    SetOutputFilter DEFLATE
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    DirectoryIndex index.html index.php
</Directory>
</VirtualHost>

如果想要给二级域名设置https证书,那么可以去腾讯云购买https服务,也可以申请一个免费的,
在这里插入图片描述
申请好证书之后,在/usr/local/nginx/conf这个路径下放证书,然后去/usr/local/nginx/conf/vhost下的test.bbb.com.conf中修改文件内容,修改内容->https://blog.csdn.net/qq_42805749/article/details/89399417,都修改完后重启服务器
ok,二级域名成功,访问网站成功(https)~~

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值