运行sudo nginx
命令后,我遇到了以下错误:
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Unknown error)
nginx: [emerg] bind() to [::]:80 failed (98: Unknown error)
nginx: [emerg] still could not bind()
以下是我在AWS EC2上的安全设置: 在我的Django项目中,我为nginx创建了一个配置文件:(nginx.conf) (我还使用uwsgi作为第二个Web服务器,它正在正常工作)
# the upstream components nginx needs to connect to
upstream dcohort {
server unix:///tmp/dcohort.sock;
}
server {
listen 80;
listen [::]:80;
server_name *.amazonaws.com;
access_log off;
error_log /home/ubuntu/dcohort/logs/nginx_error.log;
location / {
include /etc/nginx/uwsgi_params;
uwsgi_pass dcohort;
}
}
然后将配置导入到
/etc/nginx/nginx.conf
。http {
include /home/ubuntu/dcohort/config/nginx.conf;
# ...
}