请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

nginx: [emerg] "upstream" directive is not allowed here

启动 nginx 时报错,配置是安装视频的内容写的


# the upstream component nginx needs to connect to

upstream django {

# server unix:///path/to/your/mysite/mysite.sock; # for a file socket

server 127.0.0.1:8000; # for a web port socket (we'll use this first)

}

# configuration of the server


server {

# the port your site will be served on

listen      80;

# the domain name it will serve for

server_name 192.168.0.101; # substitute your machine's IP address or FQDN

charset     utf-8;


# max upload size

client_max_body_size 75M;   # adjust to taste


# Django media

location /media  {

    alias /Users/django/MxOnline/media;  # 指向django的media目录

}


location /static {

    alias /Users/django/MxOnline/static; # 指向django的static目录

}


# Finally, send all non-media requests to the Django server.

location / {

    uwsgi_pass  django;

    include     uwsgi_params; # the uwsgi_params file you installed

}

}


正在回答

插入代码

1回答

bobby 2018-05-24 15:21:37

你截图我看看报错 以及你是否有其他配置文件 也存在 django这个upstream?

0 回复 有任何疑惑可以回复我~
  • 提问者 Kolento #1
    非常感谢!找到问题了,我用的是 mac 环境,配置文件要放到 server 文件夹目录下,目录和 linux 不太一样
    回复 有任何疑惑可以回复我~ 2018-05-24 20:34:37
  • bobby 回复 提问者 Kolento #2
    好的,
    回复 有任何疑惑可以回复我~ 2018-05-25 18:09:15
问题已解决,确定采纳
还有疑问,暂不采纳
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号