Linux   发布时间:2022-04-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了无法在Linux上安装Nginx大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我刚刚创建了一个Ubuntu服务器.我试过安装Nginx但是我遇到了错误. root@scw-eefca0:~# sudo apt-get install nginx Reading package lists... Done Building dependency tree Reading state information... Done nginx is already th
我刚刚创建了一个ubuntu服务器.我试过安装Nginx但是我遇到了错误.
root@scw-eefca0:~# sudo apt-get install Nginx
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Nginx is already the neWest version (1.10.0-0ubuntu0.16.04.4).
0 upgraded,0 newly installed,0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation,0 B of additional disk space will be used.
Do you want to conTinue? [Y/n] Y
SetTing up Nginx-core (1.10.0-0ubuntu0.16.04.4) ...
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.
dpkg: error processing package Nginx-core (--configurE):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of Nginx:
 Nginx depends on Nginx-core (>= 1.10.0-0ubuntu0.16.04.4) | Nginx-full (>= 1.10.0-0ubuntu0.16.04.4) | Nginx-light (>= 1.10.0-0ubuntu0.16.04.4) | Nginx-extras (>= 1.10.0-0ubuntu0.16.04.4); however:
  Package Nginx-core is not configured yet.
  Package Nginx-full is not installed.
  Package Nginx-light is not installed.
  Package Nginx-extras is not installed.
 Nginx depends on Nginx-core (<< 1.10.0-0ubuntu0.16.04.4.1~) | Nginx-full (<< 1.10.0-0ubuntu0.16.04.4.1~) | Nginx-light (<< 1.10.0-0ubuntu0.16.04.4.1~) | Nginx-extras (<< 1.10.0-0ubuntu0.16.04.4.1~); however:
  Package Nginx-core is not configured yet.
  Package Nginx-full is not installed.
  Package Nginx-light is not installed.
  Package Nginx-extras is not installed.

dpkg: error processing package Nginx (--configurE):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 Nginx-core
 Nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
@H_772_18@编辑:

@H_772_18@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 Mon 2017-01-23 13:40:38 UTc; 10min ago
  Process: 12375 ExecStartPre=/usr/sbin/Nginx -t -q -g daemon on; master_process on; (code=exited,status=1/FAILURE)

Jan 23 13:40:38 scw-eefca0 systemd[1]: StarTing A high perfoRMANce web server and a reverse proxy server...
Jan 23 13:40:38 scw-eefca0 Nginx[12375]: Nginx: [emerg] socket() [::]:80 Failed (97: Address family not supported by protocol)
Jan 23 13:40:38 scw-eefca0 Nginx[12375]: Nginx: configuration file /etc/Nginx/Nginx.conf test Failed
Jan 23 13:40:38 scw-eefca0 systemd[1]: Nginx.service: Control process exited,code=exited status=1
Jan 23 13:40:38 scw-eefca0 systemd[1]: Failed to start A high perfoRMANce web server and a reverse proxy server.
Jan 23 13:40:38 scw-eefca0 systemd[1]: Nginx.service: Unit entered Failed state.
Jan 23 13:40:38 scw-eefca0 systemd[1]: Nginx.service: Failed with result 'exit-code'.
@H_772_18@这是一个全新的服务器,除了更新apt-get之外我没有配置任何东西.

解决方法

Nginx: [emerg] socket() [::]:80 Failed (97: Address family not supported by protocol)
@H_772_18@Nginx尝试启动,并连接到[::]:80,但不能.可能是因为在计算机上禁用了IPv6.启用IPv6或更改Nginx配置.在配置文件/etc/Nginx/Nginx.conf中搜索此行:

listen [::]:80 default_server;
@H_772_18@并评论出来:

# listen [::]:80 default_server;
@H_772_18@重启Nginx

systemctl Nginx restart
@H_772_18@或者,如果这给出了错误,它没有运行:

systemctl Nginx start
@H_772_18@然后再次运行install命令.

大佬总结

以上是大佬教程为你收集整理的无法在Linux上安装Nginx全部内容,希望文章能够帮你解决无法在Linux上安装Nginx所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。