I do according to the documentation . Install uwsgi and nginx turned out. I downloaded the file uwsgi_params , created the file mysite_nginx.conf
# mysite_nginx.conf # the upstream component nginx needs to connect to upstream django { # server unix:///path/to/your/mysite/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 server server { # the port your site will be served on listen 8000; # the domain name it will serve for server_name localhost; # 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/ubuntu/myproject/mysite/friends_plans/media; # your Django project's media files - amend as required } location /static { alias /home/ubuntu/myproject/mysite/friends_plans/static; # your Django project's static files - amend as required } # Finally, send all non-media requests to the Django server. location / { uwsgi_pass django; include /home/ubuntu/myproject/mysite/uwsgi_params; # the uwsgi_params file you installed } } Completed commands
$ sudo ln -s ~/path/to/your/mysite/mysite_nginx.conf /etc/nginx/sites-enabled/ $ python manage.py collectstatic $ sudo /etc/init.d/nginx restart I try to enter the browser localhost:8000 , the inscription "Unable to connect. Firefox can't create a connection to the server at localhost: 8000 ..." appears.
Using port 80, a nginx greeting appears. View the file with logs does not work. I executed the command /var/log/nginx/error.log , at first the answer was "permission denied", I tried a lot of things, now I ended up with "file busy". Tell me, please, what could be wrong and what should be done to start the server? Thanks a lot in advance!
(myvenv) ubuntu@ubuntu-VirtualBox:~/myproject/mysite$ sudo lsof -Pn -iTCP - sTCP:LISTEN [sudo] password for ubuntu: COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME dnsmasq 1039 nobody 5u IPv4 15044 0t0 TCP 127.0.1.1:53 (LISTEN) mysqld 1068 mysql 21u IPv4 16409 0t0 TCP 127.0.0.1:3306 (LISTEN) java 2285 ubuntu 142u IPv4 21541 0t0 TCP 127.0.0.1:6942 (LISTEN) java 2285 ubuntu 203u IPv4 22124 0t0 TCP 127.0.0.1:63342 (LISTEN) cupsd 2627 root 10u IPv6 24962 0t0 TCP [::1]:631 (LISTEN) cupsd 2627 root 11u IPv4 24963 0t0 TCP 127.0.0.1:631 (LISTEN) nginx 4230 root 6u IPv4 53589 0t0 TCP *:80 (LISTEN) nginx 4230 root 7u IPv6 53590 0t0 TCP *:80 (LISTEN) nginx 4231 www-data 6u IPv4 53589 0t0 TCP *:80 (LISTEN) nginx 4231 www-data 7u IPv6 53590 0t0 TCP *:80 (LISTEN) nginx 4232 www-data 6u IPv4 53589 0t0 TCP *:80 (LISTEN) nginx 4232 www-data 7u IPv6 53590 0t0 TCP *:80 (LISTEN) nginx 4233 www-data 6u IPv4 53589 0t0 TCP *:80 (LISTEN) nginx 4233 www-data 7u IPv6 53590 0t0 TCP *:80 (LISTEN) nginx 4234 www-data 6u IPv4 53589 0t0 TCP *:80 (LISTEN) nginx 4234 www-data 7u IPv6 53590 0t0 TCP *:80 (LISTEN) (myvenv) ubuntu@ubuntu-VirtualBox:~/myproject/mysite$ (myvenv) ubuntu@ubuntu-VirtualBox:~/myproject/mysite$ service uwsgi status ● uwsgi.service - LSB: Start/stop uWSGI server instance(s) Loaded: loaded (/etc/init.d/uwsgi) Active: failed (Result: exit-code) since Fri 2016-06-03 03:26:09 EDT; 1 day 3h ago Docs: man:systemd-sysv-generator(8) Process: 1313 ExecStart=/etc/init.d/uwsgi start (code=exited, status=127) Jun 03 03:26:09 ubuntu-VirtualBox systemd[1]: Starting LSB: Start/stop uWSGI.... Jun 03 03:26:09 ubuntu-VirtualBox uwsgi[1313]: /etc/init.d/uwsgi: line 72: /...y Jun 03 03:26:09 ubuntu-VirtualBox uwsgi[1313]: /etc/init.d/uwsgi: line 73: /...y Jun 03 03:26:09 ubuntu-VirtualBox uwsgi[1313]: * Starting app server(s) uwsgi Jun 03 03:26:09 ubuntu-VirtualBox uwsgi[1313]: /etc/init.d/uwsgi: line 80: d...d Jun 03 03:26:09 ubuntu-VirtualBox uwsgi[1313]: ...fail! Jun 03 03:26:09 ubuntu-VirtualBox systemd[1]: uwsgi.service: control process...7 Jun 03 03:26:09 ubuntu-VirtualBox systemd[1]: Failed to start LSB: Start/sto.... Jun 03 03:26:09 ubuntu-VirtualBox systemd[1]: Unit uwsgi.service entered fai.... Jun 03 03:26:09 ubuntu-VirtualBox systemd[1]: uwsgi.service failed. Hint: Some lines were ellipsized, use -l to show in full.
sudo nginx -twhat gives? To read logs usesudo less /var/log/nginx/error.log(exit with the q button) - andreymalsudo nginx -tgivesnginx: the configuration file /etc/nginx/nginx.conf syntax is oknginx: configuration file /etc/nginx/nginx.conf test is sucsessful- Anastasia Novikovasudo ls /etc/nginx/sites-enabled/? There must bemysite_nginx.conf, and if it doesn’t, it meansln -sdidn’t run - andreymalsudo less /var/log/nginx/error.logcommand for the first time, there were many lines with only the ~ character (but this is probably because I had not tried to go to localhost: 8000 in the browser), now every time startssudo less /var/log/nginx/error.log (END)- Anastasia Novikovasudo ls /etc/nginx/sites-enabled/issueddefault mysite_nginx.conf- Anastasia Novikova