一.前提要求
2.买有一个域名
二.实现例子
1.博客网站对应blog.abc.com
2.项目网站对应demo.abc.com
3.个人简历对应www.abc.com
三.实现步骤
先通过A记录申请三个二级域名,分别为上面的三个。并且映射到你的云服务器公有IP。
通过Nginx进行配置三个serve
server {
listen 80;
server_name blog.abc.com;
root /usr/share/Nginx/blog;
# Load configuration files for the default server block.
include /etc/Nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
listen 80;
server_name demo.abc.com;
root /usr/share/Nginx/demo;
# Load configuration files for the default server block.
include /etc/Nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
server {
listen 80;
server_name www.abc.com;
root /usr/share/Nginx/www;
# Load configuration files for the default server block.
include /etc/Nginx/default.d/*.conf;
location / {
}
error_page 404 /404.html;
location = /40x.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}