一級域名: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即可訪問。