无法在Linux上安装Nginx

前端之家收集整理的这篇文章主要介绍了无法在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 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)

编辑:

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'.

这是一个全新的服务器,除了更新apt-get之外我没有配置任何东西.

解决方法

Nginx: [emerg] socket() [::]:80 Failed (97: Address family not supported by protocol)

Nginx尝试启动,并连接到[::]:80,但不能.可能是因为在计算机上禁用了IPv6.启用IPv6或更改Nginx配置.在配置文件/etc/Nginx/Nginx.conf中搜索此行:

listen [::]:80 default_server;

评论出来:

# listen [::]:80 default_server;

重启Nginx

systemctl Nginx restart

或者,如果这给出了错误,它没有运行:

systemctl Nginx start

然后再次运行install命令.

原文链接:https://www.f2er.com/linux/399617.html

猜你在找的Linux相关文章