Question

Issues istalling NGINX on Ubuntu 20.04

Posted August 13, 2021 214 views
NginxUbuntu 20.04DigitalOcean Droplets

Hello all,

I was trying to install NgInx in my droplet following this tutorial:

https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-20-04

When I arrived to Step 3, checking NGINX status, I figured out that it was stopped. Then, I tried to start it running:

systemctl start nginx

And I got the following error:

$ systemctl start nginx
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start 'nginx.service'.
Authenticating as: Maxi Sbrocca,,, (maxi)
Password: 
==== AUTHENTICATION COMPLETE ===
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.

Running journalctl -xe to get further information, I see this:

...
-- The unit UNIT has successfully entered the 'dead' state.
Aug 13 17:42:26 docker-s-1vcpu-2gb-nyc1-01 sudo[42646]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Aug 13 17:42:29 docker-s-1vcpu-2gb-nyc1-01 sudo[42646]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Aug 13 18:00:21 docker-s-1vcpu-2gb-nyc1-01 sudo[43814]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
Aug 13 18:00:24 docker-s-1vcpu-2gb-nyc1-01 sudo[43814]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory

Do anyone know how to solve this issue?

Thanks in advance

2 comments
  • Hello @KFSys ..

    Thank you very much for you comment. Finally, I realized that I don’t need to start nginx in my droplet (long story of a no devops expert). Anyway, I think the copy of you file will probably help another users. I saw that nay users (no digital ocean users) had this same issue. Really don know if it is something related with the ubuntu distribution version. Or If I executed a command that deleted it -> for sure that I didn’t intentionally deleted it.

    Regarding your second comment, what I see when

    systemctl status nginx.service

    is executed in my droplet is:

    ~# systemctl status nginx.service
    ● 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 Fri 2021-08-13 18:05:24 UTC; 1 day 21h ago
           Docs: man:nginx(8)
        Process: 43869 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
        Process: 43878 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
    
    Aug 13 18:05:22 docker-s-1vcpu-2gb-nyc1-01 systemd[1]: Starting A high performance web server and a reverse proxy server...
    Aug 13 18:05:22 docker-s-1vcpu-2gb-nyc1-01 nginx[43878]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    Aug 13 18:05:22 docker-s-1vcpu-2gb-nyc1-01 nginx[43878]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    Aug 13 18:05:23 docker-s-1vcpu-2gb-nyc1-01 nginx[43878]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    Aug 13 18:05:23 docker-s-1vcpu-2gb-nyc1-01 nginx[43878]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    Aug 13 18:05:24 docker-s-1vcpu-2gb-nyc1-01 nginx[43878]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
    Aug 13 18:05:24 docker-s-1vcpu-2gb-nyc1-01 nginx[43878]: nginx: [emerg] still could not bind()
    Aug 13 18:05:24 docker-s-1vcpu-2gb-nyc1-01 systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
    Aug 13 18:05:24 docker-s-1vcpu-2gb-nyc1-01 systemd[1]: nginx.service: Failed with result 'exit-code'.
    Aug 13 18:05:24 docker-s-1vcpu-2gb-nyc1-01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
    

    I guess this because now I’m using the 80 port for my docker container.

    Thanks a lot!

  • Hi @maxisbrocca,

    Yes, if you are using Docker on port 80, Nginx won’t be able to start on it. If you are going to use Nginx with Docker, I don’t think you need Nginx installed on your Droplet, you can just use the Docker image for it.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
1 answer

Hi @maxisbrocca,

It’s very strange that you are missing this file. Have you made any changes or removed anything prior to starting the tutorial?

Anyway, here is a copy of the said file which you can use

# /etc/securetty: list of terminals on which root is allowed to login.
# See securetty(5) and login(1).

console

# Local X displays (allows empty passwords with pam_unix's nullok_secure)
:0
:0.0
:0.1
:1
:1.0
:1.1
:2
:2.0
:2.1
:3
:3.0
:3.1
#...


# ==========================================================
#
# TTYs sorted by major number according to Documentation/devices.txt
#
# ==========================================================

# Virtual consoles
tty1
tty2
tty3
tty4
tty5
tty6
tty7
tty8
tty9
tty10
tty11
tty12
tty13
tty14
tty15
tty16
tty17
tty18
tty19
tty20
tty21
tty22
tty23
tty24
tty25
tty26
tty27
tty28
tty29
tty30
tty31
tty32
tty33
tty34
tty35
tty36
tty37
tty38
tty39
tty40
tty41
tty42
tty43
tty44
tty45
tty46
tty47
tty48
tty49
tty50
tty51
tty52
tty53
tty54
tty55
tty56
tty57
tty58
tty59
tty60
tty61
tty62
tty63

# UART serial ports
ttyS0
ttyS1
ttyS2
ttyS3
ttyS4
ttyS5
#...ttyS191

# Serial Mux devices    (Linux/PA-RISC only)
ttyB0
ttyB1
#...

# Chase serial card
ttyH0
ttyH1
#...

# Cyclades serial cards
ttyC0
ttyC1
#...ttyC31

# Digiboard serial cards
ttyD0
ttyD1
#...

# Stallion serial cards
ttyE0
ttyE1
#...ttyE255

# Specialix serial cards
ttyX0
ttyX1
#...

# Comtrol Rocketport serial cards
ttyR0
ttyR1
#...

# SDL RISCom serial cards
ttyL0
ttyL1
#...

# Hayes ESP serial card
ttyP0
ttyP1
#...

# Computone IntelliPort II serial card
ttyF0
ttyF1
#...ttyF255

# Specialix IO8+ serial card
ttyW0
ttyW1
#...

# Comtrol VS-1000 serial controller
ttyV0
ttyV1
#...

# ISI serial card
ttyM0
ttyM1
#...

# Technology Concepts serial card
ttyT0
ttyT1
#...

# Specialix RIO serial card
ttySR0
ttySR1
#...ttySR511

# Chase Research AT/PCI-Fast serial card
ttyCH0
ttyCH1
#...ttyCH63

# Moxa Intellio serial card
ttyMX0
ttyMX1
#...ttyMX127

# SmartIO serial card
ttySI0
ttySI1
#...

# USB dongles
ttyUSB0
ttyUSB1
ttyUSB2
#...

# LinkUp Systems L72xx UARTs
ttyLU0
ttyLU1
ttyLU2
ttyLU3

# StrongARM builtin serial ports
ttySA0
ttySA1
ttySA2

# SCI serial port (SuperH) ports and SC26xx serial ports
ttySC0
ttySC1
ttySC2
ttySC3
ttySC4
ttySC5
ttySC6
ttySC7
ttySC8
ttySC9

# ARM "AMBA" serial ports
ttyAM0
ttyAM1
ttyAM2
ttyAM3
ttyAM4
ttyAM5
ttyAM6
ttyAM7
ttyAM8
ttyAM9
ttyAM10
ttyAM11
ttyAM12
ttyAM13
ttyAM14
ttyAM15

# Embedded ARM AMBA PL011 ports (e.g. emulated by QEMU)
ttyAMA0
ttyAMA1
ttyAMA2
ttyAMA3

# DataBooster serial ports
ttyDB0
ttyDB1
ttyDB2
ttyDB3
ttyDB4
ttyDB5
ttyDB6
ttyDB7

# SGI Altix console ports
ttySG0

# Motorola i.MX ports
ttySMX0
ttySMX1
ttySMX2

# Marvell MPSC ports
ttyMM0
ttyMM1

# PPC CPM (SCC or SMC) ports
ttyCPM0
ttyCPM1
ttyCPM2
ttyCPM3
ttyCPM4
ttyCPM5

# Altix serial cards
ttyIOC0
ttyIOC1
#...ttyIOC31

# NEC VR4100 series SIU
ttyVR0

# NEC VR4100 series SSIU
ttyVR1

# Altix ioc4 serial cards
ttyIOC84
ttyIOC85
#...ttyIOC115

# Altix ioc3 serial cards
ttySIOC0
ttySIOC1
#...ttySIOC31

# PPC PSC ports
ttyPSC0
ttyPSC1
ttyPSC2
ttyPSC3
ttyPSC4
ttyPSC5

# ATMEL serial ports
ttyAT0
ttyAT1
#...ttyAT15

# Hilscher netX serial port
ttyNX0
ttyNX1
#...ttyNX15

# Xilinx uartlite - port
ttyUL0
ttyUL1
ttyUL2
ttyUL3

# Xen virtual console - port 0
xvc0

# pmac_zilog - port
ttyPZ0
ttyPZ1
ttyPZ2
ttyPZ3

# TX39/49 serial port
ttyTX0
ttyTX1
ttyTX2
ttyTX3
ttyTX4
ttyTX5
ttyTX6
ttyTX7

# SC26xx serial ports (see SCI serial ports (SuperH))

# MAX3100 serial ports
ttyMAX0
ttyMAX1
ttyMAX2
ttyMAX3

# OMAP serial ports
ttyO0
ttyO1
ttyO2
ttyO3

# User space serial ports
ttyU0
ttyU1

# A2232 serial card
ttyY0
ttyY1

# IBM 3270 terminal Unix tty access
3270/tty1
3270/tty2
#...

# IBM iSeries/pSeries virtual console
hvc0
hvc1
#...
#IBM pSeries console ports
hvsi0
hvsi1
hvsi2

# Equinox SST multi-port serial boards
ttyEQ0
ttyEQ1
#...ttyEQ1027

# ==========================================================
#
# Not in Documentation/Devices.txt
#
# ==========================================================

# Embedded Freescale i.MX ports
ttymxc0
ttymxc1
ttymxc2
ttymxc3
ttymxc4
ttymxc5

# LXC (Linux Containers)
lxc/console
lxc/tty1
lxc/tty2
lxc/tty3
lxc/tty4

# Serial Console for MIPS Swarm
duart0
duart1

# s390 and s390x ports in LPAR mode
ttysclp0

# ODROID XU4 serial console
ttySAC0
ttySAC1
ttySAC2
ttySAC3
  • Hi again,

    I gave this more thought and I’m sure you just missed the Nginx errors in the journal. When you type in

    systemctl status nginx.service
    

    What do you see?