Summer Sale! All accounts are 50% off this week.

rangel's avatar

How to install Nginx on Ubuntu with ARM64 architecture, on AWS EC2? When trying to install with APT, this was the result:

I downloaded the packages directly from the nginx website, and it worked.

Setting up nginx-core (1.18.0-6ubuntu14.3) ...

Job for nginx.service failed because the control process exited with error code.

See "systemctl status nginx.service" and "journalctl -xeu nginx.service" 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 Sun 2023-05-07 18:47:29 UTC; 8ms ago

   Docs: man:nginx(8)

Process: 7630 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited,

status=1/FAILURE)

    CPU: 4ms

May 07 18:47:29 ip-10-0-1-78 systemd[1]: Starting A high performance web server and a reverse proxy server...

May 07 18:47:29 ip-10-0-1-78 nginx[7630]: nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)

May 07 18:47:29 ip-10-0-1-78 nginx[7630]: nginx: configuration file /etc/nginx/nginx.conf test failed

May 07 18:47:29 ip-10-0-1-78 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE

May 07 18:47:29 ip-10-0-1-78 systemd[1]: nginx.service: Failed with result 'exit-code'.

May 07 18:47:29 ip-10-0-1-78 systemd[1]: Failed to start A high performance web server and a reverse proxy server.

dpkg: error processing package nginx-core (--configure):

installed nginx-core package post-installation script subprocess returned error exit status 1

dpkg: dependency problems prevent configuration of nginx:

nginx depends on nginx-core (<< 1.18.0-6ubuntu14.3.1~) | nginx-full (<< 1.18.0-6ubuntu14.3.1~) | nginx-light (<< 1.18.0-6ubuntu14.3.1~) | nginx-extras (<< 1.18.0-6ubuntu14.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.

nginx depends on nginx-core (>= 1.18.0-6ubuntu14.3) | nginx-full (>= 1.18.0-6ubuntu14.3) | nginx-light (>= 1.18.0- 6ubuntu14.3) | nginx-extras (>= 1.18.0-6ubuntu14.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.

dpkg: error processing package nginx (--configure):

dependency problems - leaviNo apport report written because the error message indicates its a followup error from a previous failure.

                                                                                                                                  ng unconfigured

Processing triggers for ufw (0.36.1-4build1) ...

Processing triggers for man-db (2.10.2-1) ...

Processing triggers for libc-bin (2.35-0ubuntu3.1) ...

Processing triggers for php8.1-cli (8.1.2-1ubuntu2.11) ...

Processing triggers for php8.1-fpm (8.1.2-1ubuntu2.11) ...

Errors were encountered while processing:

nginx-core

nginx

needrestart is being skipped since dpkg has failed

E: Sub-process /usr/bin/dpkg returned an error code (1)

I downloaded the packages directly from the nginx website, and it worked.

0 likes
3 replies
LaryAI's avatar
Level 58

The error message indicates that the configuration file /etc/nginx/nginx.conf is missing. To fix this issue, you can create the missing file and restart the nginx service. Here are the steps:

  1. Create the nginx configuration file:
sudo nano /etc/nginx/nginx.conf
  1. Add the following content to the file:
user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;
}

http {

    ##
    # Basic Settings
    ##

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

    # server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

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

    ##
    # SSL Settings
    ##

    # ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    # ssl_prefer_server_ciphers on;

    ##
    # Logging Settings
    ##

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    ##
    # Gzip Settings
    ##

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    ##
    # Virtual Host Configs
    ##

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
  1. Save and close the file.

  2. Restart the nginx service:

sudo systemctl restart nginx

This should fix the issue and allow you to use nginx on your ARM64 architecture Ubuntu instance on AWS EC2.

rangel's avatar

I downloaded the packages directly from the nginx website, and it worked.

Tray2's avatar

You do it the same way as you would a regular non-arm install and setup.

Please or to participate in this conversation.