静态资源文件夹imooc放在home目录
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
#第一种使用root /imooc会拼接在/home后面
location /imooc {
root /home;
}
#第二种使用别名,隐藏文件真实路径
location /static {
alias /home/imooc;
}
location = /50x.html {
root html;
}
}