Ubuntu
Ubuntu 10.10 上的 Apache 和 Nginx
我正在執行帶有三個 apache 虛擬主機的 Ubuntu 10.10。我只是按照本教程使用 PAssenger 和 nginx 在 Ubuntu 上設置 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)
配置 Apache 以將 Ruby 域的請求轉發到 nginx,您現在已經在埠 8000 上偵聽。
確保你有一個
NameVirtualHost *:80
地方(你可能有它/etc/apache2/ports.conf
,因為你在 Apache 上有兩個站點)。並啟用 mod_proxy (a2enmod proxy
)。然後將此配置添加為新的虛擬主機:<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>