6👍
This worked for me
sudo fuser -k 80/tcp
And then
service nginx start
Source: https://rtcamp.com/tutorials/nginx/troubleshooting/emerg-bind-failed-98-address-already-in-use/
- Make Celery use Django's test database without task_always_eager
- How do I use ensure_csrf_cookie?
- Django time difference with F object
- How to avoid putting environment variables into multiple places with Django, nginx and uWSGI?
- Makemessages for an app installed in virtualenv
2👍
Daemontools starting nginx successfully, then nginx daemonizes, and then daemontools tries to start nginx again, unsuccessfully, logging an error to the log.
The solution to this problem is to disable daemon mode in the main section of the nginx.conf:
daemon off;
- Don't load 'initial_data.json' fixture when testing
- Why does python new york time zone display 4:56 instead 4:00?
1👍
Tired with nginx restart issues and “address in use” faults. Decided to make it work once and for all.
Added just one line at the end stop and restart action in /etc/init.d/nginx file
nginx -s quit
so it looks now like (and ensure that nginx folder is in PATH variable, otherwise specify the full path)
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON || true
echo "$NAME."
nginx -s quit
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON || true
nginx -s quit
sleep 1
test_nginx_config
start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
echo "$NAME."
;;
Hope that this solution will work for others.
- Django.rest_framework: How to serialize one to many to many?
- How should template names be set dynamically using class based views?
- Overriding Django REST ViewSet with custom post method and model
0👍
Always test your config first, it will show syntax errors and duplicate lines and point you there.
nginx -t
You will see logs there showing you what is causing the failure.
- How to remove these '"' in django template
- How to implement an "undo" feature using Python/Django
- How to change default django User model to fit my needs?
- How do I setup messaging and session middleware in a Django RequestFactory during unit testing
0👍
It’s because you aren’t restarting as root.
Change to root:
sudo -i
Restart:
service nginx restart
Or:
/etc/init.d/nginx restart
- Django: How to save original filename in FileField?
- Django and service workers – serve "sw.js" at application's root url
- Docker compose for production and development
- New chat message notification Django Channels
- VueJS props are undefined in component