亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

django - nginx+uwsgi啟動提示unknown directive "location?/"(新手)
迷茫
迷茫 2017-04-24 09:09:45
0
1
1574

p.s: 環(huán)境是ubuntu16.04,項目的目錄是/home/alps/mysite

# uwsgi啟動正常
uwsgi -i uwsgi.ini

/home/alps/mysite/uwsgi.ini配置文件如下

[uwsgi]
socket = 127.0.0.1:8001
chdir=/home/alps/mysite/
wsgi-file = mysite/wsgi.py

processes = 2
threads = 4

chmod-socket = 664

/etc/nginx/sites-enabled/mysite.conf的配置文件如下

server{
    location?/ {
        listen?80;
        uwsgi_pass?127.0.0.1:8001?
        include?????/etc/nginx/uwsgi_params;
    }
}

下面是報錯信息

$ sudo service nginx configtest
 * Testing nginx configuration    [fail] 

$ systemctl restart nginx.service
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.

$ systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2016-09-29 19:52:25 CST; 11s ago
  Process: 3450 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Starting A high performance web server and a reverse proxy server...
nginx: [emerg] unknown directive "location?/" in /etc/nginx/sites-enabled/mysite.conf:2
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx.service: Control process exited, code=exited status=1
Failed to start A high performance web server and a reverse proxy server.
nginx.service: Unit entered failed state.
nginx.service: Failed with result 'exit-code'.

請問"location /"為什么是unknown directive呢?

迷茫
迷茫

業(yè)精于勤,荒于嬉;行成于思,毀于隨。

reply all(1)
伊謝爾倫

You can clearly see a problem

9月 27 22:41:01 yue nginx[4206]: nginx: [emerg] unknown directive "server " in /etc/nginx/sites-enabled/mysite.conf:1
9月 27 22:41:01 yue nginx[4206]: nginx: configuration file /etc/nginx/nginx.conf test failed

Your configuration does not even pass nginx's own configuration verification, which means there is something wrong with your nginx configuration.
Then I saw that your configuration included

include /etc/nginx/sites-enabled/*;

You can be sure that the error is because of your nginx configuration /etc/nginx/sites-enabled/mysite.conf
I think you need to check your configuration again, don’t rush to use supervisor. If your forwarding configuration has startup problems, It has nothing to do with supervisor at all.
I suggest you follow this idea,

First, modify the configuration correctly. I see that your nginx conf is configured to forward unix:///tmp/mysite.sock; your uwsgi configuration does not specify a socket to listen to a certain port. Now I think you can try to set it up. The socket parameter of uwsgi listens to a certain port, for example

socket = 127.0.0.1:8001

Then change nginx’s forwarding uwsgi_pass unix:///tmp/mysite.sock; to
uwsgi_pass 127.0.0.1:8001

Then go to uwsgi -i uwsgi.ini and see if the forwarding can come over

If this is successful, the error you are reporting now should be solved. Look at the back

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template