Ubuntu 10.10上的Apache&Nginx

我用三个apache虚拟主机运行Ubuntu 10.10。 我只是按照这个教程在Ubuntu上使用PAssenger和nginx设置Rails 3 。

除了rails / nginx,一切都运行良好。 当我尝试启动它时,我收到以下消息:

* Starting Nginx Server... nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use) nginx: [emerg] still could not bind() ...done. 

不确定是什么问题。 我必须使用nginx而不是apache? 在这一点上,我只是一个新手,所以我会很感激,如果有任何答案牢记在心。

编辑

apache2ctl -S输出这个:

  default server pixelcraftwebdesign.com (/etc/apache2/httpd.conf:4) port 80 namevhost pixelcraftwebdesign.com (/etc/apache2/httpd.conf:4) port 80 namevhost opsandss.com (/etc/apache2/httpd.conf:8) port 80 namevhost ergo-metric.com (/etc/apache2/httpd.conf:16) port 80 namevhost admin.nflspot.com (/etc/apache2/httpd.conf:24) port 80 namevhost utcmeme.com (/etc/apache2/httpd.conf:29) port 80 namevhost ruby.pixelcraftwebdesign.com (/etc/apache2/httpd.conf:37) wildcard NameVirtualHosts and _default_ servers: *:* is a NameVirtualHost default server myServer (/etc/apache2/sites-enabled/000-default:1) port * namevhost myServer (/etc/apache2/sites-enabled/000-default:1) port 443 namevhost myServer (/etc/apache2/sites-enabled/default-ssl:2) 

configurationApache将Ruby域的请求转发给nginx,您现在已经在端口8000上监听。

确保你有一个NameVirtualHost *:80地方(你可能在/etc/apache2/ports.conf有这个,因为你在Apache上有两个站点)。 并启用mod_proxy( a2enmod proxy )。 然后添加这个configuration作为一个新的虚拟主机:

 <VirtualHost *:80> ServerName ruby.website1.com ServerAlias website3.com ProxyPreserveHost On ProxyPass / http://127.0.0.1:8000/ ProxyPassReverse / http://127.0.0.1:8000/ </VirtualHost> 

你有Apache占用端口80.如果你不移动/重命名Nginx的'站点启用/默认'configuration文件(1.0 +最近推出),Nginx将尝试启动端口80无论什么 – 即使你指定一个不同的听Nginx的端口。

移动/重命名文件,并在'nginx.conf'中用'listen'指令指示不同的端口。