尝试在 Ubuntu 16 中安装 NGINX,但无法安装 nginx,并出现有关语言环境设置的错误

尝试在 Ubuntu 16 中安装 NGINX,但无法安装 nginx,并出现有关语言环境设置的错误

我正在尝试在 Godaddy 上的 Ubuntu 16 上安装 Nginx,但出现了区域设置错误。

我有一个使用 AXIOS 的完整 MongoDB Express React Node 项目。我在使用 REDUX 添加 REST api 之前部署了此项目。该项目无法正常工作,因为 nginx.conf 错误(可能在其他地方,但错误是 post 方法 (405))。

因此,当我发现一篇有关正确部署 MERN 项目的文章时,我想重新部署该项目。

我只是想要一个新的开始......

这是我尝试使用此命令在 ubuntu 中安装 nginx 时收到的错误:

sudo apt-get install -y build-essential openssl libssl-dev pkg-config

我尝试了从此链接获得的其他答案,但没有用。就像在 ubuntu 中输入一堆命令一样。

https://askubuntu.com/questions/1015398/cant-set-locales-ubuntu-16-04

ETC....

这是我得到的错误,

perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 36967 files and directories currently installed.)
Removing nginx-common (1.10.3-0ubuntu0.16.04.3) ...
Purging configuration files for nginx-common (1.10.3-0ubuntu0.16.04.3) ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up postfix (3.1.0-3ubuntu0.3) ...
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

但是如果我不管上述错误继续部署,我会得到以下信息:

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: enabled)
   Active: failed (Result: exit-code) since Tue 2019-01-08 21:14:31 MST; 23ms ago
  Process: 18459 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Jan 08 21:14:31 s166-62-124-233.secureserver.net nginx[18459]: nginx: [emerg] socket() [::]:80 failed ...l)
Jan 08 21:14:31 s166-62-124-233.secureserver.net nginx[18459]: nginx: configuration file /etc/nginx/ng...ed
Hint: Some lines were ellipsized, use -l to show in full.
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.3-0ubuntu0.16.04.3) | nginx-full (>= 1.10.3-0ubuntu0.16.04.3) | nginx-light (>= 1.10.3-0ubuntu0.16.04.3) | nginx-extras (>= 1.10.3-0ubuntu0.16.04.3); 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.3-0ubuntu0.16.04.3.1~) | nginx-full (<< 1.10.3-0ubuntu0.16.04.3.1~) | nginx-light (<< 1.10.3-0ubuntu0.16.04.3.1~) | nginx-extras (<< 1.10.3-0ubuntu0.16.04.3.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
Processing triggers for libc-bin (2.23-0ubuntu9) ...
Processing triggers for systemd (229-4ubuntu19) ...
Errors were encountered while processing:
 nginx-core
 nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ 

该网站有“Apache2 Ubuntu 默认页面”

这是网站“Apache2 Ubuntu 默认页面”上的屏幕截图

答案1

在运行 nginx 之前您是否尝试过禁用 Apache?

我承认我在服务器管理方面是个新手,但是当我尝试在运行 apache 的情况下安装 nginx 时,我也遇到了类似的问题。

可以解释 Apache 默认页面 - 如果您无论如何都期待 nginx 默认页面。

尝试停止 apache 并尝试再次安装 nginx

sudo systemctl stop apache2

如果这有帮助,您可能需要禁用 apache,以便它不会再次自行运行,如果这是您的意图。

如果您想完全禁用 Apache,请参阅此主题:如何禁用 apache2 服务器在开机时自动启动

相关内容