Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Laracast13's avatar

install nginx Ubuntu

Hi,

Using Ubuntu server in AWS , trying install nginx

  1. run sudo apt update works

  2. but when runnging command sudo apt install nginx getting error

ubuntu@ip-172-25-239-15:~$ sudo apt install nginx Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4 nginx-common nginx-core Suggested packages: libgd-tools fcgiwrap nginx-doc ssl-cert The following NEW packages will be installed: fontconfig-config fonts-dejavu-core libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8 libnginx-mod-http-image-filter libnginx-mod-http-xslt-filter libnginx-mod-mail libnginx-mod-stream libtiff5 libwebp6 libxpm4 nginx nginx-common nginx-core 0 upgraded, 17 newly installed, 0 to remove and 0 not upgraded. Need to get 2432 kB of archives. After this operation, 7891 kB of additional disk space will be used. Do you want to continue? [Y/n] y Err:1 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 fonts-dejavu-core all 2.37-1 Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (3.87.126.146), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu. com:80 (52.73.36.184), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (18.232.150.247), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (52.207.133.243), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (52.91.65.63), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (34.201.250.36), connection timed out Could not conn ect to us-east-1.ec2.archive.ubuntu.com:80 (54.165.17.230), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (34.237. 137.22), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (54.87.19.168), connection timed out Could not connect to u s-east-1.ec2.archive.ubuntu.com:80 (3.209.10.109), connection timed out Err:2 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 fontconfig-config all 2.13.1-2ubuntu3 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:3 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libfontconfig1 amd64 2.13.1-2ubuntu3 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Ign:4 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libjpeg-turbo8 amd64 2.0.3-0ubuntu1.20.04.1 Err:5 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libjpeg8 amd64 8c-2ubuntu8 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:6 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libjbig0 amd64 2.1-3.1build1 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Ign:7 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libwebp6 amd64 0.6.1-2ubuntu0.20.04.1 Ign:8 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libtiff5 amd64 4.1.0+git191117-2ubuntu0.20.04.2 Err:9 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal/main amd64 libxpm4 amd64 1:3.5.12-1 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Ign:10 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgd3 amd64 2.2.5-5.2ubuntu2.1 Ign:11 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx-common all 1.18.0-0ubuntu1.2 Ign:12 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-image-filter amd64 1.18.0-0ubuntu1.2 Ign:13 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-xslt-filter amd64 1.18.0-0ubuntu1.2 Ign:14 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-mail amd64 1.18.0-0ubuntu1.2 Ign:15 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-stream amd64 1.18.0-0ubuntu1.2 Ign:16 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx-core amd64 1.18.0-0ubuntu1.2 Ign:17 http://us-east-1.ec2.archive.ubuntu.com/ubuntu focal-updates/main amd64 nginx all 1.18.0-0ubuntu1.2 Err:4 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libjpeg-turbo8 amd64 2.0.3-0ubuntu1.20.04.1 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:7 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libwebp6 amd64 0.6.1-2ubuntu0.20.04.1 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:8 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libtiff5 amd64 4.1.0+git191117-2ubuntu0.20.04.2 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:10 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libgd3 amd64 2.2.5-5.2ubuntu2.1 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:11 http://security.ubuntu.com/ubuntu focal-updates/main amd64 nginx-common all 1.18.0-0ubuntu1.2 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:12 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-image-filter amd64 1.18.0-0ubuntu1.2 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:13 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-http-xslt-filter amd64 1.18.0-0ubuntu1.2 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:14 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-mail amd64 1.18.0-0ubuntu1.2 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:15 http://security.ubuntu.com/ubuntu focal-updates/main amd64 libnginx-mod-stream amd64 1.18.0-0ubuntu1.2 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:16 http://security.ubuntu.com/ubuntu focal-updates/main amd64 nginx-core amd64 1.18.0-0ubuntu1.2 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: Err:17 http://security.ubuntu.com/ubuntu focal-updates/main amd64 nginx all 1.18.0-0ubuntu1.2 Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu-core_2.37-1_all.deb Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (3.87.126.146), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (52.73.36.184), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (18.232.150.247), connection timed out Could not connect to us-east- 1.ec2.archive.ubuntu.com:80 (52.207.133.243), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (52.91.65.63), connect ion timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (34.201.250.36), connection timed out Could not connect to us-east-1.ec2.ar chive.ubuntu.com:80 (54.165.17.230), connection timed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (34.237.137.22), connection tim ed out Could not connect to us-east-1.ec2.archive.ubuntu.com:80 (54.87.19.168), connection timed out Could not connect to us-east-1.ec2.archive.ub untu.com:80 (3.209.10.109), connection timed out E: Failed to fetch http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/main/f/fontconfig/fontconfig-config_2.13.1-2ubuntu3_all.deb Unable to conn ect to us-east-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/main/f/fontconfig/libfontconfig1_2.13.1-2ubuntu3_amd64.deb Unable to conne ct to us-east-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.3-0ubuntu1.20.04.1_amd64.deb Unable to conne ct to us-east-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg8-empty/libjpeg8_8c-2ubuntu8_amd64.deb Unable to connect to us-east-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/main/j/jbigkit/libjbig0_2.1-3.1build1_amd64.deb Unable to connect to us-ea st-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libw/libwebp/libwebp6_0.6.1-2ubuntu0.20.04.1_amd64.deb Unable to connect to us-eas t-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/t/tiff/libtiff5_4.1.0+git191117-2ubuntu0.20.04.2_amd64.deb Unable to connect to us -east-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://us-east-1.ec2.archive.ubuntu.com/ubuntu/pool/main/libx/libxpm/libxpm4_3.5.12-1_amd64.deb Unable to connect to us-east-1 .ec2.archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/libg/libgd2/libgd3_2.2.5-5.2ubuntu2.1_amd64.deb Unable to connect to us-east-1.ec2 .archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nginx/nginx-common_1.18.0-0ubuntu1.2_all.deb Unable to connect to us-east-1.ec2. archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nginx/libnginx-mod-http-image-filter_1.18.0-0ubuntu1.2_amd64.deb Unable to conne ct to us-east-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nginx/libnginx-mod-http-xslt-filter_1.18.0-0ubuntu1.2_amd64.deb Unable to connec t to us-east-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nginx/libnginx-mod-mail_1.18.0-0ubuntu1.2_amd64.deb Unable to connect to us-east -1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nginx/libnginx-mod-stream_1.18.0-0ubuntu1.2_amd64.deb Unable to connect to us-ea st-1.ec2.archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nginx/nginx-core_1.18.0-0ubuntu1.2_amd64.deb Unable to connect to us-east-1.ec2. archive.ubuntu.com:http: E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/n/nginx/nginx_1.18.0-0ubuntu1.2_all.deb Unable to connect to us-east-1.ec2.archive .ubuntu.com:http: E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

0 likes
7 replies
Laracast13's avatar

@Tray2 Thanks About Install PHP-FPM using the command below. udo apt install php-fpm php-cli php-curl php-mysql php-curl php-gd php-mbstring php-pear -y

will install the default PHP7.4-FPM, how change it to8.1 ?

Sinnbeck's avatar

@www888 For some reason the guide does not show you how to install the correct PPA.

sudo apt-add-repository ppa:ondrej/php

This will make sure you get the newest stuff :)

You can install specific versions by telling it to. Example

sudo apt install php8.0-fpm php8.0-cli
1 like
Laracast13's avatar

@Sinnbeck

If I run sudo apt-add-repository ppa:ondrej/php and then sudo apt install php-fpm php-cli this will install last version of php ?

If I use nginx User sudo apt-add-repository ppa:ondrej/php or ? sudo add-apt-repository ppa:ondrej/nginx-mainline

Sinnbeck's avatar

@www888

  1. I suggest that you tell it exactly what version you want. I am unsure what ondrej will default to. Best to be explicit.

  2. Just install the php one, and install nginx seperately. No need to the ondrej/nginx-mainline (at least I have never used it)

Laracast13's avatar

@Sinnbeck Check several tutorials and can not find correct way . I want install php 8.1.3

I did like this sudo apt-add-repository ppa:ondrej/php sudo apt-get install -y php-cli php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-bcmath This is correct ?

Sinnbeck's avatar

@www888 Its 2 commands. First one just adds the PPA. The second installs the software. So first add the ppa, and the install the software

I added the version for you..

sudo apt-get install -y php8.1-cli php8.1-json php8.1-common php8.1-mysql php8.1-zip php8.1-gd php8.1-mbstring php8.1-curl php8.1-xml php8.1-bcmath
1 like

Please or to participate in this conversation.