您的位置:首页 > 运维架构 > Nginx

nginx静态文件

2018-01-05 19:11 239 查看
[root@iZwz92gq6i22d162qyetwjZ opt]# vim /etc/nginx/conf.d/django.conf
server {
listen       8888;
server_name  localhost;

#charset koi8-r;

#access_log  logs/host.access.log  main;

location / {
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:8000 }

location / {
alias /opt/sites/django-blog/env/django/static;
}

#error_page  404              /404.html;
error_page 404 /404.html;
location = /40x.html {
}

# redirect server error pages to the static page /50x.html
#
error_page   500 502 503 504  /50x.html;
location = /50x.html {
root   html;
}


}

alias与root区别

location /a/b/ {
root /aa/bb/;
}


nginx把请求映射为/a/b/aa/bb/test.png

location /a/b/ {
alias /aa/bb/;
}


nginx把请求映射为/aa/bb/test.png
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: