如何在 Ubuntu 14.04 中用 apache 替换 nginx

如何在 Ubuntu 14.04 中用 apache 替换 nginx

我最近刚刚安装了 Ubuntu 14.04。

我现在正在使用以下方式设置我的 LAMP 堆栈本指南,在启动 apache2 时我收到一些错误:

$ sudo service apache2 restart
(98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

$ sudo netstat -lnpt
tcp  0  0  0.0.0.0:80 LISTEN 21254/nginx

啊哈!原来 Nginx 就是罪魁祸首!经过一番搜索,我发现在这篇博文中Nginx 是一个新的服务器,提供与 Apache 相同的功能(或多或少?)。它一定是随 Ubuntu 14.04(?) 一起打包的。我是一名刚接受培训的 Web 开发人员,只想使用 Apache 来运行 Ruby on Rails 应用程序等。

我现在想用 Apache 替换 Nginx。

我找到并尝试了以下答案 如何删除 nginx 并重新激活 apache?无法删除 NGINX

但所有命令都导致

Package 'nginx' is not installed, so not removed

有人能帮助我完全删除 Nginx 以便让 Apache 正常工作吗?

答案1

好的,我按照论坛中的说明 (抱歉,丢失了 URL) 使用 Nginx 运行 apache2。

我将 apache 监听端口从 80 改为 81

/etc/apache2/ports.conf

/etc/apache2/sites-enabled/000-default.conf

Apache2 现已运行,通过在浏览器中输入 localhost:81 进行测试!哇哦!

相关内容