AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[aws](ubuntu)

Martin Hope
workfily app
Asked: 2020-11-22 04:13:25 +0800 CST

nginx更新配置文件后重启失败如何解决

  • 0

我在重新启动 nginx 时遇到问题。我对 ubuntu 和 nginix 很陌生。我正在尝试更改 nginx.conf 和 default.conf(新创建)的配置。我的主要目标是将我的 MERN 应用程序部署到 Amazon Ec2

这里分别是我的配置

server {
    #listen       80;
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name  yourdomain.com;

    access_log /home/ubuntu/client/server_logs/host.access.log main;

    location / {
        root   /home/ubuntu/client/deploy;
        index  index.html index.htm;
        try_files $uri /index.html;
        add_header X-Frame-Options SAMEORIGIN;
        add_header X-Content-Type-Options nosniff;
        add_header X-XSS-Protection "1; mode=block";
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
    }

    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }

    server_tokens off;

    location ~ /\.ht {
        deny  all;
    }

}

user ubuntu;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    client_body_buffer_size 100k;
    client_header_buffer_size 1k;
    client_max_body_size 100k;
    large_client_header_buffers 2 1k;
    client_body_timeout 10;
    client_header_timeout 10;
    keepalive_timeout 5 5;
    send_timeout 10;
    server_tokens off;
    #gzip  on; on;

    include /etc/nginx/conf.d/*.conf;
}

如果我尝试使用以下命令“sudo service nginx restart”重新启动 nginx,则会收到以下错误:

Job for nginx.service failed because the control process exited with an error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

由于我对 ubuntu 和 nginx 的经验很少,我真的需要有人告诉我做错了什么。或者是否有任何我可以访问的链接有助于理解 nginx 配置。任何帮助将不胜感激

从 systemctl status nginx.service 和 journalctl -xe 输出”:

● 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 2020-11-21 12:23:42 UTC; 22s ago
       Docs: man:nginx(8)
    Process: 21094 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)

Nov 21 12:23:42 ip-172-31-23-90 systemd[1]: Starting A high performance web server and a reverse proxy server...
Nov 21 12:23:42 ip-172-31-23-90 nginx[21094]: nginx: [emerg] unknown directive "sten" in /etc/nginx/conf.d/default.conf:1
Nov 21 12:23:42 ip-172-31-23-90 nginx[21094]: nginx: configuration file /etc/nginx/nginx.conf test failed
Nov 21 12:23:42 ip-172-31-23-90 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Nov 21 12:23:42 ip-172-31-23-90 systemd[1]: nginx.service: Failed with result 'exit-code'.
Nov 21 12:23:42 ip-172-31-23-90 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
The job identifier is 5626.
Nov 21 12:23:42 ip-172-31-23-90 nginx[21094]: nginx: [emerg] unknown directive "sten" in /etc/nginx/conf.d/default.conf:1
Nov 21 12:23:42 ip-172-31-23-90 nginx[21094]: nginx: configuration file /etc/nginx/nginx.conf test failed
Nov 21 12:23:42 ip-172-31-23-90 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd

我还用“cat /var/log/nginx/error.log”检查了错误日志,我得到了以下信息:

ubuntu@ip-172-31-23-90:~$ cat /var/log/nginx/error.log
2020/11/21 07:47:49 [emerg] 18846#18846: unknown directive "er" in /etc/nginx/nginx.conf:1
2020/11/21 07:54:57 [emerg] 18898#18898: unknown directive "er" in /etc/nginx/nginx.conf:1
2020/11/21 07:59:37 [emerg] 18924#18924: unknown directive "er" in /etc/nginx/nginx.conf:1
2020/11/21 11:09:41 [emerg] 20449#20449: unknown directive "er" in /etc/nginx/nginx.conf:1
2020/11/21 11:20:03 [emerg] 20485#20485: unknown directive "er" in /etc/nginx/nginx.conf:1
2020/11/21 11:52:44 [emerg] 20822#20822: unknown directive "sten" in /etc/nginx/conf.d/default.conf:1
2020/11/21 12:23:42 [emerg] 21094#21094: unknown directive "sten" in /etc/nginx/conf.d/default.conf:1
server nginx aws
  • 1 个回答
  • 2765 Views
Martin Hope
Fibericon
Asked: 2020-11-18 03:25:00 +0800 CST

cURL 在不允许时收到 HTTP/0.9,但安装了 nghttp2

  • 11

我正在尝试为 Monero 节点设置钱包 RPC,但是当我使用 cURL 到该端口时,我收到此错误:

curl: (1) Received HTTP/0.9 when not allowed

但是,检查 curl --version 给了我这个:

curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3

我认为只有在没有 nghttp2 的情况下编译 cURL 时才会出现该错误。这是一个运行 20.04 的 AWS 环境。

aws curl 20.04
  • 4 个回答
  • 50584 Views
Martin Hope
Ten Digit Grid
Asked: 2020-10-23 14:05:56 +0800 CST

AWS EC2 Ubuntu 16.04.7 LTS 升级问题

  • 3

我有一个运行网站的 AWS EC2 实例,在升级它时遇到了问题。

以下是我尝试过的步骤:

$ sudo apt update
$ sudo apt upgrade

在此处输入图像描述

在第一部分之后,一切看起来都很好,然后我继续:

sudo do-release-upgrade

然后我们出错了:

Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/bionic", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 2072, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1981, in fullUpgrade
    if not self.askDistUpgrade():
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1153, in askDistUpgrade
    changes = self.calcDistUpgrade()
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1120, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeCache.py", line 856, in installTasks
    pkg.mark_install()
  File "/usr/lib/python3/dist-packages/apt/package.py", line 1356, in mark_install
    fixer.resolve(True)
SystemError: E:Unable to correct problems, you have held broken packages.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/problem_report.py", line 497, in add_to_existing
    self.write(f)
  File "/usr/lib/python3/dist-packages/problem_report.py", line 450, in write
    block = f.read(1048576)
  File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Original exception was:
Traceback (most recent call last):
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/bionic", line 8, in <module>
    sys.exit(main())
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeMain.py", line 238, in main
    if app.run():
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 2072, in run
    return self.fullUpgrade()
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1981, in fullUpgrade
    if not self.askDistUpgrade():
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1153, in askDistUpgrade
    changes = self.calcDistUpgrade()
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeController.py", line 1120, in calcDistUpgrade
    if not self.cache.installTasks(self.tasks):
  File "/tmp/ubuntu-release-upgrader-_29ga8ky/DistUpgrade/DistUpgradeCache.py", line 856, in installTasks
    pkg.mark_install()
  File "/usr/lib/python3/dist-packages/apt/package.py", line 1356, in mark_install
    fixer.resolve(True)
SystemError: E:Unable to correct problems, you have held broken packages.
=== Command terminated with exit status 1 (Thu Oct 22 03:03:11 2020) ===

在查看了更多错误之后,我认为这是我的问题所在,但我仍然卡住了,不知道从这里做什么:

Reinst Failed because of python3-zope.interface:amd64  MarkKeep python3-twisted [ amd64 ]
upgrade aws amazon-ec2
  • 2 个回答
  • 1892 Views
Martin Hope
Anonymous shooter
Asked: 2020-08-13 11:12:36 +0800 CST

无法登录使用 AMI 创建的 amazion ec2

  • 0

我无法使用密码登录我的 aws ec2 实例

这里我解释一下我做了什么

  1. 创建新的 aws ec2 实例(删除密钥登录并启用密码登录)
  2. 创建图像
  3. 再次使用之前创建的 AMI 创建新实例

然后我尝试通过 ssh new create instances 登录,但我无法登录?(在新情况下)

aws amazon-ec2
  • 1 个回答
  • 130 Views
Martin Hope
allada01
Asked: 2020-07-17 03:46:20 +0800 CST

如何在命令行中 grep JSON 键的值?

  • 1

这是我的这个命令的 JSON 输出,aws logs list-log-groups我需要从这里获取第一个“arn”值。我怎样才能做到这一点?

{
    "logGroups": [
        {
            "logGroupName": "alla",
            "creationTime": 1594638588652,
            "metricFilterCount": 0,
            "arn": "arn:aws:logs:us-east-1:12345678910:log-group:*:*",
            "storedBytes": 0
        },
        {
            "logGroupName": "mahi",
            "creationTime": 1594638580461,
            "metricFilterCount": 0,
            "arn": "arn:aws:logs:us-east-1:12345678910:log-group:*:*",
            "storedBytes": 0
        }
    ]
}
command-line aws text-processing
  • 2 个回答
  • 4888 Views
Martin Hope
IgorAlves
Asked: 2020-06-23 08:13:21 +0800 CST

AWS-CLI 已安装但无法正常工作(未找到命令“aws”)Ubuntu 18.04。如何解决?

  • 1

按照以下步骤在全新的 Ubuntu 18.04中安装AWS-CLI:

  1. sudo apt update
  2. sudo apt upgrade
  3. sudo apt install python3-pip
  4. sudo apt install npm(我将使用 NodeJS)
  5. pip3 install awscli --upgrade --user

在第 5 步之后,我应该能够看到aws-cli版本。但这就是我得到的:

  1. aws --version

    找不到命令“aws”,但可以安装:

    sudo apt install awscli(我什么也没做)

但如果我签入ll ~/.local/bin 这就是我所拥有的:

drwxrwxr-x 2 ubuntu ubuntu 4096 Jun 22 15:46 __pycache__/
-rwxrwxr-x 1 ubuntu ubuntu  815 Jun 22 15:46 aws*
-rwxrwxr-x 1 ubuntu ubuntu 1432 Jun 22 15:46 aws.cmd*
-rwxrwxr-x 1 ubuntu ubuntu  204 Jun 22 15:46 aws_bash_completer*
-rwxrwxr-x 1 ubuntu ubuntu 1136 Jun 22 15:46 aws_completer*
-rwxrwxr-x 1 ubuntu ubuntu 1807 Jun 22 15:46 aws_zsh_completer.sh*
  1. 如果我运行python3 -m awscli --version这就是我得到的:

    aws-cli/1.18.84 Python/3.6.9 Linux/4.15.0-1065-aws botocore/1.17.7

所以它似乎aws-cli已安装并且已经在~/.local/bin但不响应aws configure命令。

我错过了什么?

更新


这就是在$PATH

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
command-line aws 18.04
  • 1 个回答
  • 7903 Views
Martin Hope
Mohamed Hafez
Asked: 2020-06-12 07:08:40 +0800 CST

在 AWS 上从 Intel 切换到 AMD CPU - 我需要做什么?

  • 1

我将我的 Ubuntu 18.04 AWS 实例切换为在 AMD 处理器而不是 Intel 上运行,一切似乎都运行良好,但我想知道是否有任何我应该注意的问题。

例如,我是否需要安装任何新软件包,例如 AMD 微码更新包而不是 Intel 微码更新包?

对于apt我安装的软件包,我知道 Intel 和 AMD 芯片的目标是 amd64,但是安装是否检测到正在使用哪个处理器并针对其中一个进行优化?

出于上述原因或任何其他原因,我是否最好从空白实例进行全新的重新安装?

64-bit intel aws amd-processor
  • 1 个回答
  • 834 Views
Martin Hope
Adam
Asked: 2020-02-09 15:42:12 +0800 CST

当亚马逊需要 Grub 但 Ubuntu 阻止它时,如何从实例存储中制作 Ubuntu 的 AMI 映像?

  • 2

Ubuntu 仅具有适用于 Amazon 的 HVM 映像 ( https://cloud-images.ubuntu.com/locator/ec2/ )

根据亚马逊的说法,如果您使用 grub v2 并从 HVM 开始,则根本无法创建 AMI:

“必须在您的实例上安装 GRUB Legacy(版本 0.9x 或更低版本)。” (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/create-instance-store-ami.html#ubuntu_instructions)

但是 Ubuntu 当前版本不再具有低于 v2 的 grub(我相信是从仿生开始的?)。

这似乎是一个 catch-22,亚马逊坚持使用非常古老的 grub(这让我感到困惑)与 Ubuntu 仅支持 HVM 基础映像(亚马逊阻止它们时这似乎是一个糟糕的决定)相结合。我该如何逃脱呢?:)

更新:亚马逊支持的回应是他们不再支持没有 EBS 的 AMI,所以没有人应该使用它(而且,我猜,他们需要更新/删除他们解释如何做到这一点的文档!)

grub2 aws
  • 2 个回答
  • 229 Views
Martin Hope
jackw11111
Asked: 2019-10-09 20:27:55 +0800 CST

从 AWS 服务器批量下载文件

  • 0

我想下载 MOOC 课程的所有文件。我相信文件所在的目录具有私有访问权限,而文件具有公共访问权限。

该服务器是 AWS 服务器,所以我知道他们有一个 CLI。

那么,在 Linux/Ubuntu 上,使用 AWS CLI 下载文件的方法是什么?

但其次,这可以只用一个 bash 脚本来完成吗?

如果您只能访问文件,有没有办法打印目录中的所有文件?

我不需要完整的脚本,只是获取目录中所有文件列表的解决方法:https ://s3.amazonaws.com/edx-course-spdx-kiczales/HTC/

应该是这样的:

more-arithmetic-expression-starter.rkt
more-arithmetic-expression-solution.rkt
tile-starter.rkt
tile-solution.rkt
compare-images-starter.rkt
compare-images-solution.rkt
more-foo-evaluation-starter.rkt
...

无论如何,我已经手动完成并在目录中找到了文件的每个名称,但是由于我可能会完成更多课程,而且他们通常会以相同的方式托管材料文件,如果有一个批量方法来从(AWS)服务器下载文件。

感谢您的帮助

server command-line bash aws
  • 1 个回答
  • 143 Views
Martin Hope
BlueDogRanch
Asked: 2019-08-15 07:48:58 +0800 CST

在具有相同 PEM 密钥的两台机器之间使用 scp

  • 0

我正在尝试使用 scp 在机器之间复制目录。我以 ubuntu 身份登录到目标框 10.10.10.98。(IP 不是真实的)。我想my-theme从另一个盒子 10.10.10.99 复制主题目录。我可以在另一个终端(OS X)窗口中以 ubuntu OK 身份登录 10.10.10.99。Devops 为两个盒子设置了相同的 AWS PEM 密钥。

但是当我跑步时

scp -r [email protected]:/var/www/html/prod/wp-content/themes/my-theme /var/www/html/wp-content/themes/my-theme

它挂起,没有错误或进展。我需要指定 pem 密钥吗?有任何想法吗?

server ssh aws scp
  • 2 个回答
  • 53 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve