A first step Tencent cloud console login information to fill in the secondary domain name
Second, click Add record, fill in the information
Host record fields to fill in second-level domain names they want to use, type and line type recording system default to record the value of their own to fill the external server network ip, click Save.
Third, the next step is to configure nginx
My nginx source compiler is installed, install in / usr / local / nginx /
Profiles /usr/local/nginx/conf/nginx.conf
Modify the configuration file nginx.conf
Two separate domain configuration file to configure
So enter the appropriate location and create a name ending in .conf file
Each server in the secondary domain name should be written inside
server{
listen 80;
server_name abc.flyfly520.club;#腾讯云后台自己新建的二级域名
#index index.html index.htm index.php;
#root html/test/public;
#if ($host != abc.flyfly520.club) { return 301 $scheme://abc.flyfly520.club$request_uri; }
location / {
root html/test/public;#二级域名根目录
proxy_set_header Host $host:$server_port;
index index.html index.html index.php;
if ( !-e $request_filename) {
rewrite ^(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php(.*)$ {
root html/test/public/;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html/test;
}
}
四、重启nginx服务
浏览器输入网址测试
补充说明:添加了test作为名称的二级域名一直不能使用,不知道什么原因,有哪位大佬知道欢迎留言评论。