Node.js 我试图在Ubuntu 16.04中安装nginx,但我在语言环境设置方面遇到了一个错误

Node.js 我试图在Ubuntu 16.04中安装nginx,但我在语言环境设置方面遇到了一个错误,node.js,reactjs,shell,ubuntu,nginx,Node.js,Reactjs,Shell,Ubuntu,Nginx,我试图在我的Ubuntu16.04(Xenial Xerus)上安装nginx,但我遇到了区域设置错误 我有一个完整的MongoDB Express React Node.js项目。在添加RESTAPI之前,我部署了这个项目。项目无法正常工作,因为nginx.conf是错误的(可能是在其他地方,但错误是post方法(405)) 因此,我想重新部署该项目,因为我找到了正确部署项目的方法 我只是想要一个新的开始 这是我尝试在Ubuntu上使用以下命令安装nginx时遇到的错误: sudo apt-g

我试图在我的Ubuntu16.04(Xenial Xerus)上安装nginx,但我遇到了区域设置错误

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

因此,我想重新部署该项目,因为我找到了正确部署项目的方法

我只是想要一个新的开始

这是我尝试在Ubuntu上使用以下命令安装nginx时遇到的错误:

sudo apt-get install -y build-essential openssl libssl-dev pkg-config
我尝试了其他的答案,但都不起作用。比如在Ubuntu中输入一堆命令

等等

这将导致以下错误:

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)
$
nginx.service的作业失败,因为控制进程带错误代码退出。有关详细信息,请参阅“systemctl status nginx.service”和“journalctl-xe”。 调用rc.d:initscript nginx,操作“启动”失败。 ● nginx.service-高性能web服务器和反向代理服务器 已加载:已加载(/lib/systemd/system/nginx.service;已启用;供应商预设:已启用) 活动:自2019-01-08星期二21:14:31 MST以来失败(结果:退出代码);23毫秒前 进程:18459 ExecStartPre=/usr/sbin/nginx-t-q-g守护进程打开;掌握有关程序;(代码=退出,状态=1/失败) Jan 08 21:14:31 s166-62-124-233.secureserver.net nginx[18459]:nginx:[emerg]socket()[::]:80失败…l) Jan 08 21:14:31 s166-62-124-233.secureserver.net nginx[18459]:nginx:configuration file/etc/nginx/ng…ed 提示:有些行已省略,请使用-l完整显示。 dpkg:错误处理包nginx core(--configure): 安装的子进程安装后脚本返回错误退出状态1 dpkg:依赖性问题阻止了nginx的配置: nginx依赖于nginx核心(>=1.10.3-0ubuntu0.16.04.3)| nginx完整(>=1.10.3-0ubuntu0.16.04.3)| nginx光(>=1.10.3-0ubuntu0.16.04.3)| nginx附加(>=1.10.3-0ubuntu0.16.04.3);然而: 尚未配置包nginx core。 未安装程序包nginx full。 未安装包nginx灯。 未安装包nginx extras。 nginx依赖于nginx核心(只需执行

sudo apt-get update
sudo apt-get install nginx
而不是在命令中包含git-y。它非常简单,您不必这样做,因为它在您的服务器上或本地找到git,这是一个依赖项。

只需这样做即可

sudo apt-get update
sudo apt-get install nginx

不要在命令中包含git-y。这很简单,而且你不必这样做,因为它在你的服务器上或本地找到git,这是一个依赖项。

如果你在nginx之前运行apache2服务,都使用默认端口配置,那么apache2正在使用80端口,你无法启动nginx服务器,be因为它试图在同一默认80端口上运行


尝试停止Apache2服务→
sudo服务apache2停止
,然后启动nginx服务→
sudo service nginx start
,或者在nginx或Apache 2端口配置文件中指定一个不同的端口,以便同时使用服务器。

如果在nginx之前运行Apache 2服务,两者都使用默认端口配置,则Apache 2正在使用80端口,并且您无法启动nginx服务器,因为它正在运行g在相同的默认80端口上运行


尝试停止Apache2服务→
sudo服务apache2停止
,然后启动nginx服务→
sudo service nginx start
,或者在nginx或Apache 2端口配置文件中指定一个不同的端口以同时使用服务器。

我在以前尝试的所有VP上都有相同的区域设置错误。但是我认为区域设置(lang)错误与nginx没有冲突。您可以忽略这些消息。只需听取建议并照顾其他消息。我非常确定我需要运行此命令
sudo service nginx reload&&sudo service nginx restart
当我执行此命令时,我得到nginx。服务未激活,无法重新加载。我通常按照vishal singh的回答方式安装nginx。如果您试图在安装后启动服务,并且出现错误,则可能需要升级ubuntu并重新安装nginx;因此,如果您已经配置了nginx,则可以使用
nginx-t
测试配置。
$nginx-t nginx:[警报]无法打开错误日志文件:open()“/var/log/nginx/error.log”失败(13:权限被拒绝)2019/01/08 23:28:47[警告]22960#22960:只有当主进程以超级用户权限运行时,“用户”指令才有意义,在/etc/nginx/nginx.conf:1 2019/01/08 23:28:47[紧急]22960#22960:指令“代理#通行证”未被终止在/etc/nginx/sites enabled/LCTW:4 nginx:configuration file/etc/nginx/nginx.conf测试失败
这是我得到的错误。如何更新ubuntu?是否完全重置?尝试像superuser>
sudo nginx-t这样的命令
我在所有vps上都有我以前尝试过的相同的语言环境错误。但是我认为语言环境(lang)错误与nginx没有冲突。您可以忽略这些消息。只需听取建议并照顾其他消息。我非常确定我需要运行此命令
sudo service nginx reload&&sudo service nginx restart
当我执行此命令时,我得到nginx。服务未激活,无法重新加载。我通常按照vishal singh的回答方式安装nginx。如果您试图在安装后启动服务,并且出现错误,则可能需要升级ubuntu并重新安装nginx;因此,如果您已经配置了nginx,则可以使用
nginx-t
测试配置。
$nginx-t nginx:[警报]无法打开错误日志文件:open()“/var/log/nginx/error.log”失败(13:权限被拒绝)2019/01/08 23:28:47[警告]22960#22960:只有当主进程以超级用户权限运行时,“用户”指令才有意义,在/etc/nginx/nginx.conf:1 2019中被忽略