第一遍这么输入的:uwsgi--socket:8001--wsgi-filetest.py没有问题第二遍输入:uwsgi--socketmysite.sock--wsgi-filetest.py就不对了bind():Operationnotpermitted[core/socket.cline230]第二遍用新的参数重新启动uwsgi的时候出上面的报错uwsgi--socketmysite.sock--wsgi-filetest.py--chmod-socket=666这样也不行项目文件夹的读写权限如下:drwxr-xr-x1vagrantvagrant374Feb307:32mysite/显然写权限只属于vagrant用户。那么我是否把整个项目文件夹的写权限全部允许给uwsgi就可以了?UsingUnixsocketsinsteadofportsSofarwehaveusedaTCPportsocket,becauseit’ssimpler,butinfactit’sbettertouseUnixsocketsthanports-there’slessoverhead.Editmysite_nginx.conf,changingittomatch:serverunix:///path/to/your/mysite/mysite.sock;#forafilesocket#server127.0.0.1:8001;#forawebportsocket(we'llusethisfirst)andrestartnginx.RunuWSGIagain:uwsgi--socketmysite.sock--wsgi-filetest.pyThistimethesocketoptiontellsuWSGIwhichfiletouse.Tryhttp://example.com:8000/inthebrowser.Ifthatdoesn’tworkCheckyournginxerrorlog(/var/log/nginx/error.log).Ifyouseesomethinglike:connect()tounix:///path/to/your/mysite/mysite.sockfailed(13:Permissiondenied)thenprobablyyouneedtomanagethepermissionsonthesocketsothatnginxisallowedtouseit.Try:uwsgi--socketmysite.sock--wsgi-filetest.py--chmod-socket=666#(verypermissive)or:uwsgi--socketmysite.sock--wsgi-filetest.py--chmod-socket=664#(moresensible)Youmayalsohavetoaddyourusertonginx’sgroup(whichisprobablywww-data),orvice-versa,sothatnginxcanreadandwritetoyoursocketproperly.It’sworthkeepingtheoutputofthenginxlogrunninginaterminalwindowsoyoucaneasilyrefertoitwhiletroubleshooting.
慕妹3146593
幕布斯6054654
相关分类