树莓派nginx无法安装mysql_树莓派上安装nginx

在树莓派上安装nginx时遇到错误,nginx.service启动失败,显示端口80已被占用。日志显示是由于Apache2服务已使用该端口导致。解决方案是在需要使用nginx时再调整Apache2配置或更改nginx端口。
摘要由CSDN通过智能技术生成

概述

其实也就是正常的debian系统安装稳定版的nginx

参考链接

步骤

新建文件夹nginx,随便名字都可以

执行lsb_release -a查看Debian版本号:

Distributor ID: Raspbian

Description: Raspbian GNU/Linux 9.4 (stretch)

Release: 9.4

Codename: stretch

可知,版本号是9.4,代号是stretch

编辑 /etc/apt/sources.list 添加如下代码

deb http://nginx.org/packages/debian/ codename nginx

deb-src http://nginx.org/packages/debian/ codename nginx

替换 codename 为 stretch

执行 apt-get update 等待update完成

执行 apt-get install nginx安装nginx

遇到的问题

apt-get install nginx之后发现出错,信息如下:

Job for nginx.service failed because the control process exited with error code.

See "systemctl status nginx.service" and "journalctl -xe" for details.

invoke-rc.d: initscript nginx, action "start" failed.

● nginx.service - A high performance web server and a reverse proxy server

Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: en abled)

Active: failed (Result: exit-code) since Sat 2018-07-07 07:32:02 UTC; 64ms ag o

Docs: man:nginx(8)

Process: 4566 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code =exited, status=1/FAILURE)

Process: 4563 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

提醒nginx.service工作失败,请运行 systemctl status nginx.service和journalctl -xe查看详情。以下是 systemctl status nginx.service 显示的信息:

● nginx.service - A high performance web server and a reverse proxy server

Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)

Active: failed (Result: exit-code) since Sat 2018-07-07 07:32:02 UTC; 3min 37s ago

Docs: man:nginx(8)

Process: 4566 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Process: 4563 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)

Jul 07 07:32:00 dukeworks nginx[4566]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

Jul 07 07:32:01 dukeworks nginx[4566]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

Jul 07 07:32:01 dukeworks nginx[4566]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

Jul 07 07:32:01 dukeworks nginx[4566]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)

Jul 07 07:32:01 dukeworks nginx[4566]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)

Jul 07 07:32:02 dukeworks nginx[4566]: nginx: [emerg] still could not bind()

Jul 07 07:32:02 dukeworks systemd[1]: nginx.service: Control process exited, code=exited status=1

Jul 07 07:32:02 dukeworks systemd[1]: Failed to start A high performance web server and a reverse proxy server.

Jul 07 07:32:02 dukeworks systemd[1]: nginx.service: Unit entered failed state.

Jul 07 07:32:02 dukeworks systemd[1]: nginx.service: Failed with result 'exit-code'.

可以看到就是端口被占用的导致启动失败。

经检查,发现80端口被apache2占用了,这个是之前装Aria2的时候安装的。

所以这个是正常的,暂时不予解决,等真正要用到nginx的时候再改。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值