国产成人精品亚洲777人妖,欧美日韩精品一区视频,最新亚洲国产,国产乱码精品一区二区亚洲

您的位置:首頁技術文章
文章詳情頁

nginx+uwsgi部署django,8000端口正常,80端口404

瀏覽:91日期:2024-10-15 10:47:17

問題描述

按照教程用nginx+uwsgi部署django項目,監聽8000端口正常,80端口訪問時顯示404 not found.django項目目錄為/home/wu/Documents/env/myblog項目文件夾下文檔結構

nginx+uwsgi部署django,8000端口正常,80端口404

myblog_nginx.conf文件

# mysite_nginx.conf# the upstream component nginx needs to connect toupstream django { server unix:///home/wu/Documents/env/myblog/mysite.sock; # for a file socket #server 127.0.0.1:8001; # for a web port socket (we'll use this first)}# configuration of the serverserver { # the port your site will be served on listen 80; # the domain name it will serve for server_name .example.com; # 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 /home/wu/Documents/env/myblog/media; # your Django project's media files - amend as required } location /static {alias /home/wu/Documents/env/myblog/static; # your Django project's static files - amend as required } # Finally, send all non-media requests to the Django server. location / { root /home/wu/Documents/env/myblog;uwsgi_pass django;include /home/wu/Documents/env/myblog/uwsgi_params; # the uwsgi_params file you installed }}

mysite_uwsgi.ini文件

# mysite_uwsgi.ini file[uwsgi]# Django-related settings# the base directory (full path)chdir = /home/wu/Documents/env/myblog# Django's wsgi filemodule = myblog.wsgi# the virtualenv (full path)home = /home/wu/Documents/env# process-related settings# mastermaster = true# maximum number of worker processesprocesses = 10# the socket (use the full path to be safesocket = /home/wu/Documents/env/myblog/mysite.sock# ... with appropriate permissions - may be neededchmod-socket = 666# clear environment on exitvacuum = true

myblog_nginx.conf文件中改為8000端口時沒問題

nginx+uwsgi部署django,8000端口正常,80端口404

改為80端口后,raload,restart nginx,uwsgi --ini mysite_uwsgi.ini,然后訪問

nginx+uwsgi部署django,8000端口正常,80端口404

求指點,搞了好久都沒解決這個問題,感激不盡!!!

問題解答

回答1:

是不是你其他地方配置了

server { listen 80; xxx}#導致沒進入你的server塊,看下nginx.conf,或者其他虛擬主機的配置文件。另外你的server { /*這個去掉吧,或者你可以測試重復,host配置一個xxx.com, 這邊也配置為xxx.com,相比于listen 80,會優先進入這個server塊。*/ #server_name .example.com;}

回答2:

8000 端口顯示的那個頁面是 Django 自帶的測試頁,在 80 端口部署的時候應該不會出現,建議你自己寫個頁面部署到 80 端口試試

相關文章:
主站蜘蛛池模板: 赤水市| 赣州市| 图木舒克市| 凤山县| 蕉岭县| 墨玉县| 新蔡县| 葵青区| 麻栗坡县| 建平县| 鄂托克旗| 金湖县| 敦化市| 青冈县| 静安区| 略阳县| 观塘区| 尤溪县| 邳州市| 孟津县| 湖南省| 呼伦贝尔市| 腾冲县| 临泉县| 双辽市| 嵊州市| 乌拉特前旗| 两当县| 镇巴县| 忻州市| 嵩明县| 灯塔市| 南丰县| 河池市| 九台市| 平安县| 石棉县| 珠海市| 庆安县| 安福县| 本溪市|