I've a server with 2 services on it. Software are Ubuntu20.04 OS, Nginx and certbot.
So, then I check nginx status:
~$ sudo systemctl status nginx.service
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2021-12-13 10:48:55 CET; 35min ago
Docs: man:nginx(8)
....
des. 13 10:48:55 u nginx[248435]: nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
des. 13 10:48:55 u nginx[248435]: nginx: [emerg] still could not bind()
des. 13 10:48:55 u systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
des. 13 10:48:55 u systemd[1]: nginx.service: Failed with result 'exit-code'.
des. 13 10:48:55 u systemd[1]: Failed to start A high performance web server and a reverse proxy server.
and checking of configuration:
~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
But at the same time both services are up and working as they should. If I ask about nginxs' processes, i've next
~$ sudo ps -ax | grep nginx
245336 ? S 0:00 nginx: worker process
245337 ? S 0:00 nginx: worker process
245338 ? S 0:00 nginx: worker process
250704 pts/7 S+ 0:00 grep --color=auto nginx
and check one of them (it doesn't matter which one)
~$ sudo systemctl status 245336
● snap.certbot.certbot.***********.scope
Loaded: loaded (/run/systemd/transient/snap.certbot.certbot.***********.scope; transien>
Transient: yes
Active: active (running) since Mon 2021-12-13 09:39:30 CET; 1h 35min ago
I can't imagine what happens and why it works in this way. Before this problem, I updated certbot and deleted a few certifates (they were expired and unused).
Who can explain me how it's work? And why are the services up?
Related
I can't restart nginx server. the following error encountered. I suspect the cause could be that there's another service running on port 80.
I tried listing down all services running on port 80. But it does not show any.
root#ubuntu:/# sudo service nginx restart
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
root#ubuntu:/# 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 Sun 2019-04-21 15:21:14 EDT; 53s ago
Docs: man:nginx(8)
Process: 121217 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run
Process: 120160 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, stat
Process: 121540 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exi
Main PID: 120162 (code=exited, status=0/SUCCESS)
Apr 21 15:21:13 ubuntu systemd[1]: Starting A high performance web server and a reverse proxy s
Apr 21 15:21:14 ubuntu nginx[121540]: nginx: [emerg] "listen" directive is not allowed here in
Apr 21 15:21:14 ubuntu nginx[121540]: nginx: configuration file /etc/nginx/nginx.conf test fail
Apr 21 15:21:14 ubuntu systemd[1]: nginx.service: Control process exited, code=exited status=1
Apr 21 15:21:14 ubuntu systemd[1]: nginx.service: Failed with result 'exit-code'.
Apr 21 15:21:14 ubuntu systemd[1]: Failed to start A high performance web server and a reverse
I have version 3.3.5 and want to upgrade to 3.3.11. The following script was used:
#Step 1 Copy the whole data directory of arango to another location, basically a backup
cp -R /var/lib/arangodb3 /folder
#Step 2 Stop the current running process
service arangodb3 stop
#Step 3 Installing new ArangoDB, adding the key and stuff (the below is for 16.04 Ubuntu)
curl -OL https://download.arangodb.com/arangodb33/xUbuntu_16.04/Release.key
sudo apt-key add - < Release.key
sudo apt-get install apt-transport-https
sudo apt-get update
read -p "Enter the version zou want to upgrade to (For example 3.3.5)" version
sudo apt-get install arangodb3=$version
#Step 4 Start the process again with auto-upgrade option on
service arangodb3 start --database.auto-upgrade
At the end of step 3. when install the arango version this error pop up
Setting up nginx-core (1.10.3-0ubuntu0.16.04.3) ...
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" 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 Do 2018-11-22 11:07:07 CET; 8ms ago
Process: 16614 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 16610 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 1328 (code=exited, status=0/SUCCESS)
Nov 22 11:07:05 SB28 nginx[16614]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Nov 22 11:07:06 SB28 nginx[16614]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Nov 22 11:07:06 SB28 nginx[16614]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Nov 22 11:07:06 SB28 nginx[16614]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Nov 22 11:07:06 SB28 nginx[16614]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Nov 22 11:07:07 SB28 nginx[16614]: nginx: [emerg] still could not bind()
Nov 22 11:07:07 SB28 systemd[1]: nginx.service: Control process exited, code=exited status=1
Nov 22 11:07:07 SB28 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Nov 22 11:07:07 SB28 systemd[1]: nginx.service: Unit entered failed state.
Nov 22 11:07:07 SB28 systemd[1]: nginx.service: Failed with result 'exit-code'.
dpkg: error processing package nginx-core (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up arangodb3 (3.3.11) ...
Database files are up-to-date.
Errors were encountered while processing:
nginx-core
E: Sub-process /usr/bin/dpkg returned an error code (1)
An nginx error.My question is what is the role of nginx here in the upgrading of arango? (It seemed that arango cannot start it own nginx)
The problem has nothing to do with nginx. Your arangodb installation did not finish correctly as it seems. As a consequence systemctl deamon-reload errored ... Please run
sudo dpkg-reconfigure arangodb3
and update your question with the output, please.
I'm starting Nginx with this command: sudo systemctl start nginx, but I get this error:
nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2018-03-21 17:42:36 MSK; 2min 59s ago
Process: 27647 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Process: 27644 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 27641 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru nginx[27647]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru nginx[27647]: nginx: [emerg] still could not bind()
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru systemd[1]: nginx.service: control process exited, code=exited status=1
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru systemd[1]: Unit nginx.service entered failed state.
Mar 21 17:42:36 ovz1.pimex.1l0r1.vps.myjino.ru systemd[1]: nginx.service failed.
I've checked 80 port:
[habrauser#ovz1 system]$ netstat -na | grep ".80"
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
Any ideas? Thank you
Add -p to netstat like this: sudo netstat -na -p | grep ".80" and it will give you pid of the process that you should kill.
Then try sudo systemctl start nginx, for me it worked fine.
Allow port for firewall sudo firewall-cmd --zone=public --add-port=80/tcp
My NGINX server have stopped and it is generating error.
I am using Ubantu 16.04 and my app deploye at Digital Ocean Server.
When I run the following colde sudo systemctl start nginx It is giving following output:
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details.
Output of $ nginx -t is:
nginx: [emerg] BIO_new_file("/root/bitradiology.chained.crt") failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/root/bitradiology.chained.crt','r') error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
I checked the status with $ sudo systemctl status nginx
output is:
● 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 Mon 2017-08-21 11:01:51 UTC; 1min 50s ago
Process: 2085 ExecStop=/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid (code=exited, status=2)
Process: 2420 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Main PID: 2462 (code=exited, status=0/SUCCESS)
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: Starting A high performance web server and a reverse proxy server...
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 nginx[2420]: nginx: [emerg] BIO_new_file("/root/bitradiology.chained.crt") failed (SSL: error:02001002:system library:fopen:No such
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 nginx[2420]: nginx: configuration file /etc/nginx/nginx.conf test failed
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: nginx.service: Control process exited, code=exited status=1
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: nginx.service: Unit entered failed state.
Aug 21 11:01:51 ubuntu-512mb-nyc3-01 systemd[1]: nginx.service: Failed with result 'exit-code'.
lines 1-14/14 (END)
How to fix this problem
I found this bitradiology.chained.crt file into the cd /usr directory.
Then go to the following directory cd /etc/nginx/sites-enabled and open the default file
sudo nano default
I edited this file and replaced /root/ by /usr/
/root/bitradiology.chained.crt by /usr/bitradiology.chained.crt
I run the nginx config test first:
nginx -t
after the test ran successful, I can restart the service
/etc/init.d/nginx restart
NGINX has been started and my app is running right now.
Thanks!!!
Check your ssl_certificate instructions in your config files.
Nginx is clearly saying it can't find one of the files specified:
fopen:No such file or
directory:fopen('/root/bitradiology.chained.crt','r')
I could see lot more thread created for this issue. Tried all the solutions mentioned on those threads. But None of the options worked for me. So I'm creating this new thread.
OS : CentOS 7.2.1511
Nginx : 1.10.0
Error message:
Nov 2 23:21:36 localhost nginx: Starting nginx: nginx: [emerg] socket() x.x.x.x:80 failed (24: Too many open files)
Nov 2 23:21:36 localhost nginx: [FAILED]
Nov 2 23:21:36 localhost systemd: nginx.service: control process exited, code=exited status=1
Nov 2 23:21:36 localhost systemd: Failed to start SYSV: Nginx is an HTTP(S) server, HTTP(S) reverse proxy and IMAP/POP3 proxy server.
Nov 2 23:21:36 localhost systemd: Unit nginx.service entered failed state.
Nov 2 23:21:36 localhost systemd: nginx.service failed.
Ulimit Value:
[root#serv1 nginx]# ulimit -n
16000
[root#serv1 nginx]#
Sysctl.conf:
fs.file-max = 752415
nginx.conf:
worker_rlimit_nofile 30000;
nginx user Ulimit:
[nginx#serv1 ~]$ ulimit -Sn
16000
[nginx#serv1 ~]$ ulimit -Hn
16000
[nginx#serv1 ~]$
Nginx PID max Open files limit:
Max open files 1024 4096 files
Not sure, why the open files limit is not reflected to nginx process. when I checked the pid limit value from proc directory. It shows default value as mentioned above. Values should be 16000 for both soft & hard limits.
Also, I checked the openfiles limit on the server for nginx process. it does not go above 1042.
openfiles :
[root#serv1 ~]# ps -ef | grep nginx
root 4285 1 0 23:12 ? 00:00:00 nginx: master process /usr/sbin/nginx -c /etc/conf/nginx/nginx.conf
nginx 4286 4285 0 23:12 ? 00:00:00 nginx: worker process
root 4308 4290 0 23:12 pts/1 00:00:00 grep --color=auto nginx
[root#serv1 ~]# lsof -p 4285 | wc -l
1042
[root#serv1 ~]#
Someone please help me to fix this problem. Thanks.
Found the problem. its due to nginx.service file was not created as nginx is compiled manually. Once created nginx.service file and added limitonfile value in the file, fixed my problem.
Hope, this may help to people who had hit with this problem.