一级域名:http://www.jhappylife.cn
二级域名:http://blog.jhappylife.cn
二级域名:http://blogadmin.jhappylife.cn
1.首先,需要域名解析,添加记录。下图是我配置的添加的记录。
2.准备好3个项目上传到服务器相应的目录
3.配置nginx
vim /usr/local/nginx/conf/nginx.conf
使用上面的命令编辑nginx的配置文件,先把配置文件中的server注释掉,然后添加下面的语句
server {
listen 80;
server_name www.jhappylife.cn;
location / {
root /root/webapp/main;
index index.html index.htm;
}
}
server {
listen 80;
server_name blog.jhappylife.cn;
location / {
root /root/webapp/blog;
index index.html index.htm;
}
}
server {
listen 80;
server_name blogadmin.jhappylife.cn;
location / {
root /root/webapp/blogadmin;
index index.html index.htm;
}
}
4.重启nginx即可访问。