I use: sudo apt update, sudo apt install nginx but i get this:
Preconfiguring packages ...
Selecting previously unselected package libdeflate0:amd64.
(Reading database ... 27812 files and directories currently installed.)
Preparing to unpack .../00-libdeflate0_1.10-2_amd64.deb ...
Unpacking libdeflate0:amd64 (1.10-2) ...
Selecting previously unselected package libjbig0:amd64.
Preparing to unpack .../01-libjbig0_2.1-3.1ubuntu0.22.04.1_amd64.deb ...
Unpacking libjbig0:amd64 (2.1-3.1ubuntu0.22.04.1) ...
Selecting previously unselected package libwebp7:amd64.
Preparing to unpack .../02-libwebp7_1.2.2-2ubuntu0.22.04.1_amd64.deb ...
Unpacking libwebp7:amd64 (1.2.2-2ubuntu0.22.04.1) ...
Selecting previously unselected package libtiff5:amd64.
Preparing to unpack .../03-libtiff5_4.3.0-6ubuntu0.5_amd64.deb ...
Unpacking libtiff5:amd64 (4.3.0-6ubuntu0.5) ...
Selecting previously unselected package libgd3:amd64.
Preparing to unpack .../04-libgd3_2.3.0-2ubuntu2_amd64.deb ...
Unpacking libgd3:amd64 (2.3.0-2ubuntu2) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../05-nginx-common_1.18.0-6ubuntu14.4_all.deb ...
Unpacking nginx-common (1.18.0-6ubuntu14.4) ...
Selecting previously unselected package libnginx-mod-http-geoip2.
Preparing to unpack .../06-libnginx-mod-http-geoip2_1.18.0-6ubuntu14.4_amd64.deb ...
Unpacking libnginx-mod-http-geoip2 (1.18.0-6ubuntu14.4) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../07-libnginx-mod-http-image-filter_1.18.0-6ubuntu14.4_amd 64.deb ...
Unpacking libnginx-mod-http-image-filter (1.18.0-6ubuntu14.4) ...
Selecting previously unselected package libxslt1.1:amd64.
Preparing to unpack .../08-libxslt1.1_1.1.34-4ubuntu0.22.04.1_amd64.deb ...
Unpacking libxslt1.1:amd64 (1.1.34-4ubuntu0.22.04.1) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../09-libnginx-mod-http-xslt-filter_1.18.0-6ubuntu14.4_amd6 4.deb ...
Unpacking libnginx-mod-http-xslt-filter (1.18.0-6ubuntu14.4) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../10-libnginx-mod-mail_1.18.0-6ubuntu14.4_amd64.deb ...
Unpacking libnginx-mod-mail (1.18.0-6ubuntu14.4) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../11-libnginx-mod-stream_1.18.0-6ubuntu14.4_amd64.deb ...
Unpacking libnginx-mod-stream (1.18.0-6ubuntu14.4) ...
Selecting previously unselected package libnginx-mod-stream-geoip2.
Preparing to unpack .../12-libnginx-mod-stream-geoip2_1.18.0-6ubuntu14.4_amd64.d eb ...
Unpacking libnginx-mod-stream-geoip2 (1.18.0-6ubuntu14.4) ...
Selecting previously unselected package nginx-core.
Preparing to unpack .../13-nginx-core_1.18.0-6ubuntu14.4_amd64.deb ...
Unpacking nginx-core (1.18.0-6ubuntu14.4) ...
Selecting previously unselected package nginx.
Preparing to unpack .../14-nginx_1.18.0-6ubuntu14.4_amd64.deb ...
Unpacking nginx (1.18.0-6ubuntu14.4) ...
Setting up libdeflate0:amd64 (1.10-2) ...
Setting up nginx-common (1.18.0-6ubuntu14.4) ...
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142.
Setting up libjbig0:amd64 (2.1-3.1ubuntu0.22.04.1) ...
Setting up libwebp7:amd64 (1.2.2-2ubuntu0.22.04.1) ...
Setting up libxslt1.1:amd64 (1.1.34-4ubuntu0.22.04.1) ...
Setting up libtiff5:amd64 (4.3.0-6ubuntu0.5) ...
Setting up libnginx-mod-http-geoip2 (1.18.0-6ubuntu14.4) ...
Setting up libnginx-mod-mail (1.18.0-6ubuntu14.4) ...
Setting up libnginx-mod-stream (1.18.0-6ubuntu14.4) ...
Setting up libnginx-mod-http-xslt-filter (1.18.0-6ubuntu14.4) ...
Setting up libgd3:amd64 (2.3.0-2ubuntu2) ...
Setting up libnginx-mod-stream-geoip2 (1.18.0-6ubuntu14.4) ...
Setting up libnginx-mod-http-image-filter (1.18.0-6ubuntu14.4) ...
Setting up nginx-core (1.18.0-6ubuntu14.4) ...
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for det ails.
invoke-rc.d: initscript nginx, action "start" failed.
x 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 Wed 2023-08-30 11:07:00 UTC; 8ms a go
Docs: man:nginx(8)
Process: 2394907 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_pro cess on; (code=exited, status=1/FAILURE)
CPU: 5ms
Aug 30 11:07:00 Eduson systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 30 11:07:00 Eduson nginx[2394907]: nginx: [emerg] no "events" section in con figuration
Aug 30 11:07:00 Eduson nginx[2394907]: nginx: configuration file /etc/nginx/ngin x.conf test failed
Aug 30 11:07:00 Eduson systemd[1]: nginx.service: Control process exited, code=e xited, status=1/FAILURE
Aug 30 11:07:00 Eduson systemd[1]: nginx.service: Failed with result 'exit-code' .
Aug 30 11:07:00 Eduson 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.4.1~) | nginx-full (<< 1.18.0- 6ubuntu14.4.1~) | nginx-light (<< 1.18.0-6ubuntu14.4.1~) | nginx-extras (<< 1.18 .0-6ubuntu14.4.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.4) | nginx-full (>= 1.18.0-6ub untu14.4) | nginx-light (>= 1.18.0-6ubuntu14.4) | nginx-extras (>= 1.18.0-6ubunt u14.4); 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 man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
Errors were encountered while processing:
nginx-core
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried to purge the nginx but i still get this.
From journalctl -xeu nginx.service i get this:
Aug 30 11:07:00 Eduson nginx[2394907]: nginx: configuration file /etc/nginx/ngi>
Aug 30 11:07:00 Eduson systemd[1]: nginx.service: Control process exited, code=>
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStartPre= process belonging to unit nginx.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Aug 30 11:07:00 Eduson systemd[1]: nginx.service: Failed with result 'exit-code>
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit nginx.service has entered the 'failed' state with result 'exit-code>
Aug 30 11:07:00 Eduson systemd[1]: Failed to start A high performance web serve>
-- Subject: A start job for unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit nginx.service has finished with a failure.
--
-- The job identifier is 488958 and the job result is failed.
lines 1834-1856/1856 (END)
Aug 30 11:07:00 Eduson nginx[2394907]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 30 11:07:00 Eduson systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
-- Subject: Unit process exited
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- An ExecStartPre= process belonging to unit nginx.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Aug 30 11:07:00 Eduson systemd[1]: nginx.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Aug 30 11:07:00 Eduson systemd[1]: Failed to start A high performance web server and a reverse proxy server.
-- Subject: A start job for unit nginx.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- A start job for unit nginx.service has finished with a failure.
--
-- The job identifier is 488958 and the job result is failed.
Thanks for any help.