1
我運行亞馬遜的Linux AMI和nginx的,當我嘗試啓動我的nginx服務器:nginx的錯誤綁定無法分配請求地址
$ sudo /etc/init.d/nginx restart
我收到以下錯誤:
nginx: [emerg]: bind() to IP failed (99: Cannot assign requested address)
其中「IP 「是我的IP地址的佔位符。有人知道爲什麼會發生這種錯誤?這在EC2上運行。
我的nginx.conf文件看起來像這樣:
user app;
worker_processes 4;
#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css application/x-javascript application/xml application/xml+rss text/javascript;
server_names_hash_bucket_size 64;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server {
listen IP:443;
server_name name;
include /etc/nginx/ssl.conf;
}
}
kirpit說:與亞馬遜EC2彈性IP地址,服務器實際上並不知道它與大多數其他服務器的IP。所以你需要告訴你的linux允許進程綁定到非本地地址。只需將以下行添加到/etc/sysctl.conf中,然後重新加載您的sysctl.conf。
但在亞馬遜的Linux AMI bash: sysctl: command not found
AWS中的所有內容都使用NAT進行設置。只有一個私有IP直接對機器可見,並且如果您停止/啓動實例,IP將會更改(如果您使用的是VPC,則您擁有更多控制權) – datasage 2013-03-26 13:00:10