I work on one of the many very similar tutorials on deploy on a combat server using nginx, uwsgi - https://uwsgi-docs.readthedocs.io/en/latest/tutorials/Django_and_nginx.html . I did everything according to the tutorial. At each stage, the proposed checks. Configured the my_site_nginx.conf file in the project root folder:

upstream django { server unix:///tmp/momstyle.sock; } server { listen 8000; server_name momstyle-kzn.ru; location /static/ { alias /home/django/momstyle/static/; } location /media/ { alias /home/django/momstyle/media/; } location / { include /etc/nginx/uwsgi_params; uwsgi_pass django; } access_log /home/django/momstyle-access.log; error_log /home/django/momstyle-error.log; } 

created a link for the file in the directory etc / nginx / sites-enabled /, opened access for the user www-data to all the necessary files

File: momstyle_uwsgi.ini

 # mysite_uwsgi.ini file [uwsgi] # Django-related settings # the base directory (full path) chdir = /home/django/momstyle # Django's wsgi file module = momstyle.wsgi # the virtualenv (full path) home = /home/django/venv # process-related settings # master master = true # maximum number of worker processes processes = 10 # the socket (use the full path to be safe socket = /tmp/momstyle.sock chmod-socket = 664 uid = www-data gid = www-data # clear environment on exit vacuum = true plugins = python 

When running a command

  uwsgi --socket /tmp/momstyle.sock --ini momstyle_uwsgi.ini 

everything works fine, but at domain_name.ru:8000 (momstyle-kzn.ru:8000, in my case). At this stage in the tutorial, the site is already running at domain_name.ru without a port number. Actually the question is how to remove the port number and find your site at the normal address?

  • In the server section, you are listening to port 8000. Try listening to 80. - Bakhuss
  • Thank you Everything worked as it should! - Sultan Nasirov

1 answer 1

Decision

  server { listen 80; } 

in the file my_project_nginx.conf

 service nginx restart