0

我可以将 HAProxy 和 Nginx 配置到systemd在 Virtualbox VM 中运行的 Debian 8 上。

问题是由于端口冲突,Nginx 安装失败。HAProxy 首先安装并在端口 80 上运行,这是 Nginx 默认尝试启动的端口。

# apt-get install -y nginx-full
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  geoip-database libgeoip1 libxslt1.1 nginx-common
Suggested packages:
  geoip-bin fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  geoip-database libgeoip1 libxslt1.1 nginx-common nginx-full
0 upgraded, 5 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2,418 kB of archives.
After this operation, 7,362 kB of additional disk space will be used.
Selecting previously unselected package libgeoip1:amd64.
(Reading database ... 55783 files and directories currently installed.)
Preparing to unpack .../libgeoip1_1.6.2-4_amd64.deb ...
Unpacking libgeoip1:amd64 (1.6.2-4) ...
Selecting previously unselected package libxslt1.1:amd64.
Preparing to unpack .../libxslt1.1_1.1.28-2+b2_amd64.deb ...
Unpacking libxslt1.1:amd64 (1.1.28-2+b2) ...
Selecting previously unselected package geoip-database.
Preparing to unpack .../geoip-database_20150317-1_all.deb ...
Unpacking geoip-database (20150317-1) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../nginx-common_1.8.0-1~dotdeb+8.2_all.deb ...
Unpacking nginx-common (1.8.0-1~dotdeb+8.2) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.8.0-1~dotdeb+8.2_amd64.deb ...
Unpacking nginx-full (1.8.0-1~dotdeb+8.2) ...
Processing triggers for systemd (215-17+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libgeoip1:amd64 (1.6.2-4) ...
Setting up libxslt1.1:amd64 (1.1.28-2+b2) ...
Setting up geoip-database (20150317-1) ...
Setting up nginx-common (1.8.0-1~dotdeb+8.2) ...
Setting up nginx-full (1.8.0-1~dotdeb+8.2) ...
Job for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details.
invoke-rc.d: initscript nginx, action "start" failed.
dpkg: error processing package nginx-full (--configure):
 subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin (2.19-18) ...
Processing triggers for systemd (215-17+deb8u1) ...
Errors were encountered while processing:
 nginx-full
E: Sub-process /usr/bin/dpkg returned an error code (1)
#
#
# systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled)
   Active: failed (Result: exit-code) since Thu 2015-07-09 12:02:23 UTC; 10s ago

Jul 09 12:02:23 web1.dev nginx[2904]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: ... use)
Jul 09 12:02:23 web1.dev nginx[2904]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jul 09 12:02:23 web1.dev systemd[1]: nginx.service: control process exited, code=exited status=1
Jul 09 12:02:23 web1.dev systemd[1]: Failed to start A high performance web server and a reverse prox...rver.
Jul 09 12:02:23 web1.dev systemd[1]: Unit nginx.service entered failed state.
Hint: Some lines were ellipsized, use -l to show in full.

```

我尝试了以下方法在不启动服务的情况下安装 nginx:

如何在不自动启动服务的情况下使用 systemd 在 Debian 8 上安装 nginx(或任何软件包)?

4

2 回答 2

0

Ansible 中有 yum 模块:

http://docs.ansible.com/yum_module.html

例如,要安装最新版本的 Apache:

百胜:名称=httpd 状态=最新

于 2015-07-15T18:44:16.457 回答
0

即使在安装软件包之前,您也可以随时屏蔽服务以防止它们启动。对于 nginx,它将是:

systemctl mask nginx.service

要撤消上述操作并删除正在/etc/systemd/system/使用的相应符号链接:

systemctl unmask nginx.service
于 2017-02-10T02:49:06.637 回答