0
我有nginx
在sites-enabled
两个站点启用站点-:Nginx的失去了我的静态图像的一个网站在
1)project
- 这基本上是顶级域 - mysite.com
server {
listen 80;
location/{
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /static {
alias /home/www/flask-deploy/project/static/;
}
}
mysite.com:8080
server {
listen 8080;
location blog/ {
proxy_pass http://localhost:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location /static {
alias /home/www/flask-deploy/blog/static/;
}
}
Nginx的已接受两种配置中,b: - 2)blog
这是一个博客,经由可访问当我访问1
我得到的所有文字,但没有CSS或图像。
如果我访问2
我得到一切工作正常。
我在做什么错?
谢谢
“博客”的实际位置区块如何? – CodeTalk
应该静态在博客的位置块内吗? – CodeTalk
'location/blog'和'location/blog /'分别以'/ blog'和'/ blog /'开头的URI是可以接受的,后者是前者的一个子集。嵌套位置必须是子集或父URI,因此'location/blog/images'可以嵌套在'location/blog'内,但'location/images'不能。 –