第一遍這么輸入的:uwsgi--socket:8001--wsgi-filetest.py沒(méi)有問(wèn)題第二遍輸入:uwsgi--socketmysite.sock--wsgi-filetest.py就不對(duì)了bind():Operationnotpermitted[core/socket.cline230]第二遍用新的參數(shù)重新啟動(dòng)uwsgi的時(shí)候出上面的報(bào)錯(cuò)uwsgi--socketmysite.sock--wsgi-filetest.py--chmod-socket=666這樣也不行項(xiàng)目文件夾的讀寫(xiě)權(quán)限如下:drwxr-xr-x1vagrantvagrant374Feb307:32mysite/顯然寫(xiě)權(quán)限只屬于vagrant用戶(hù)。那么我是否把整個(gè)項(xiàng)目文件夾的寫(xiě)權(quán)限全部允許給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.
將uwsgi配置參數(shù)從端口號(hào)改為socket文件,需要給uwsgi哪些權(quán)限?
溫溫醬
2019-04-07 11:18:16