I try to start this service but i can´t, the error below occur:
root@zabbix:/home/appliance# 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 Wed 2018-07-25 18:33:26 UTC; 1min 27s ago
Process: 30040 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 30037 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Jul 25 18:33:25 zabbix nginx[30040]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:25 zabbix nginx[30040]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:25 zabbix nginx[30040]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:26 zabbix nginx[30040]: nginx: [emerg] listen() to 0.0.0.0:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:26 zabbix nginx[30040]: nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
Jul 25 18:33:26 zabbix nginx[30040]: nginx: [emerg] still could not bind()
Jul 25 18:33:26 zabbix systemd[1]: nginx.service: Control process exited, code=exited status=1
Jul 25 18:33:26 zabbix systemd[1]: *******Failed to start A high performance web server*** and a reverse proxy server.****
Jul 25 18:33:26 zabbix systemd[1]: nginx.service: Unit entered failed state.
Jul 25 18:33:26 zabbix systemd[1]: nginx.service: Failed with result 'exit-code'.
asked Jul 25, 2018 at 18:43
You already have a process bound to the HTTP port 80. (Specially after upgrading systems! it will start apache2 by default)
So first try this:
sudo service apache2 stop
sudo systemctl restart nginx
If problem is not solved then run this command sudo lsof -i:80
to get a list of processes using the port and then stop or disable web server.
Try to stop the process which are using the port 80 using:
sudo fuser -k 80/tcp
sudo systemctl restart nginx
In some cases it may be some issues in the configuration file.
You can use nginx -t -c /etc/nginx/nginx.conf
command to find any miss-configuration.
In some cases this error is caused by a default Nginx site already on port 80. Removing default config works if you don’t need a default one!
sudo rm /etc/nginx/sites-enabled/default
sudo service nginx restart
answered May 31, 2020 at 12:13
Mahdi YounesiMahdi Younesi
6,5192 gold badges19 silver badges50 bronze badges
5
For me this error was caused by a default
nginx site already on port 80. Removing default site worked
sudo rm /etc/nginx/sites-enabled/default
sudo service nginx restart
answered Dec 13, 2019 at 21:54
frmbelzfrmbelz
1,86924 silver badges24 bronze badges
1
You already have a process bound to the HTTP port 80.
You can run command sudo lsof -i:80
to get a list of processes using the port and then stop/disable web server.
answered Jul 25, 2018 at 21:16
Try to stop the process which are using the port 80:
sudo fuser -k 80/tcp
snoob dogg
2,5102 gold badges27 silver badges49 bronze badges
answered Feb 18, 2019 at 11:01
2
Try to stop the process which is using port 80:
sudo fuser -k 80/tcp
When you did restart using
sudo systemctl restart nginx
answered Sep 26, 2020 at 5:01
SudhanSudhan
1813 silver badges12 bronze badges
It may be some issues in the configuration file. You can use this
nginx -t -c /etc/nginx/nginx.conf
command to find any bugs in the configuration file. If you find the bugs resolve that run the sudo service nginx restart
again. It will work.
Please check the reference here
answered Nov 1, 2019 at 8:19
sanzmalzsanzmalz
4184 silver badges12 bronze badges
In my experience, this error can be triggered in several different situations (which might have the same root, but are perceived as different scenarios).
Not only port 80
Depending on your nginx config, you should also try port 443:
sudo lsof -i:80
sudo lsof -i:443
You should be able to check your nginx listen ports in /etc/nginx/sites-enabled
(under Debian)
Special case
In my case, there was an nginx instance running, that would block itself from restarting. It would not go down with sudo systemctl stop nginx
. I had to use sudo killall nginx
and could then use sudo systemctl start nginx
.
Config error
I also experienced the exact same error message on a config error.
You can check your nginx config with /usr/sbin/nginx -c /etc/nginx/nginx.conf@ (this will also test all virtual host files (
/etc/nginx/sites-enabled`)
answered Sep 13, 2020 at 8:59
DarkTrickDarkTrick
1,8531 gold badge15 silver badges33 bronze badges
i had same issue, was because i have apache and nginx on same server !
so when i typed sudo reboot it didn’t work because it started apache while am using nginx so i just run this two commands
sudo systemctl stop apache2
then
sudo systemctl start nginx
then sudo systemctl disable apache2
so next time i reboot not going to face same issue
help from aws services support
answered Dec 2, 2020 at 23:38
1
I had to use:
sudo killall nginx
And could then use;
sudo systemctl start nginx
benson23
11.2k8 gold badges17 silver badges33 bronze badges
answered Feb 24, 2022 at 21:44
0
For me stopping apache service solved the problem
sudo service apache2 stop
answered Oct 31, 2020 at 3:38
sudaynsudayn
1,09411 silver badges14 bronze badges
0
I had this problem too. I checked the /etc/nginx/site-available/default
file and I have forgotten to close the bracket (syntax error).
סטנלי גרונן
2,87923 gold badges48 silver badges66 bronze badges
answered May 8, 2020 at 4:43
Just restart the nginx server. It should resolve your problem
sudo systemctl restart nginx
answered Oct 22, 2022 at 14:05
I was using gunicorn with nginx, found that service was not active.
sudo systemctl enable gunicorn.socket
sudo systemctl start gunicorn.socket
sudo systemctl restart nginx
Worked for me.
if your gunicorn is active, please make sure it’s working fine.
you can also go through the logs(errors) via nginx logs
from
sudo tail -f /var/log/nginx/error.log
answered Aug 20, 2022 at 11:56
Table of Contents
Hide
- Reasons of this error
-
Solutions
- 1. nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
- 2. nginx: [emerg] unexpected end of file, expecting “;” or “}” in /etc/nginx/c>
- 3. nginx: [emerg] a duplicate default server for [::]:80 in /etc/nginx/sites-enabled/default
- 4. nginx: [emerg] unknown directive “stream” in /etc/nginx/nginx.conf
- 5. nginx: [emerg] directive “root” is not terminated by “;” in /etc/nginx/conf.d/writefreely.conf:6
- 6. Error in configuration file
-
Conclusion
- Related Posts
You run the command systemctl status nginx.service
or sudo systemctl start nginx
and bam, you got a scary multi lines error stating that nginx failed to start high performance web server and a reverse proxy server. In this article we will focus on resolving this issue completely.
Reasons of this error
The error is generic. It means there could be multiple reasons for nginx failing to start. Your error logs will show you the reason as to why this is happening. Some of them are –
- nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
- nginx: [emerg] unexpected end of file, expecting “;” or “}” in /etc/nginx/c>
- nginx: [emerg] a duplicate default server for [::]:80 in /etc/nginx/sites-enabled/default
- nginx: [emerg] unknown directive “stream” in /etc/nginx/nginx.conf
- nginx: [emerg] directive “root” is not terminated by “;” in /etc/nginx/conf.d/writefreely.conf:6
- Others..
Let’s look at each of these errors and solve them.
Solutions
1. nginx: [emerg] listen() to [::]:80, backlog 511 failed (98: Address already in use)
This error appears when the nginx port i.e. 80 and 443 are occupied by some other process like Apache. The solution is to kill all the process which are running on these ports and let nginx use them.
First get the list of all the processes that are running on port 80 –
sudo lsof -i:80
Next, we will stop all these processes –
sudo fuser -k 80/tcp
If apache2 is running on this port then you may also stop it directly –
sudo service apache2 stop
Now you may start your nginx server –
sudo service nginx restart
2. nginx: [emerg] unexpected end of file, expecting “;” or “}” in /etc/nginx/c>
This error shows that there is some syntax error in config file. Open the indicated file at /etc/nginx/
and check for the syntax errors in the file.
3. nginx: [emerg] a duplicate default server for [::]:80 in /etc/nginx/sites-enabled/default
This error arises when you have multiple nginx websites running. Since they all are using the same 80 port so there is a clash. The solution is to change ports or if you can disable them like default website, then do that.
First remove or unlink the default website –
sudo unlink /etc/nginx/sites-enabled/default # OR sudo rm /etc/nginx/sites-enabled/default
Restart the nginx server –
sudo service nginx restart
4. nginx: [emerg] unknown directive “stream” in /etc/nginx/nginx.conf
nginx use the stream module and if we load it dynamically then nginx fails to start and throw this error. To resolve it, you need to statically add the stream module.
First open the nignx.conf
file located at /etc/nignx/nginx.conf
and add the below code at the very top of this file –
load_module /usr/lib/nginx/modules/ngx_stream_module.so;
Here you need to check whether this ngx_stream_module
is located in lib
or lib64
on your operating system. In CentOS it is in lib64. So, the address will change to –
load_module /usr/lib64/nginx/modules/ngx_stream_module.so;
Then save the nginx.conf
file and run these commands in your terminal –
nginx -t nginx -s reload service nginx restart
5. nginx: [emerg] directive “root” is not terminated by “;” in /etc/nginx/conf.d/writefreely.conf:6
This is again a syntax error in a file. It is saying that “root” is not terminated by semicolon. So, solution is to open the file located at /etc/nginx/conf.d/writefreely.conf
, move to line number 6 and add a semicolon at the end.
6. Error in configuration file
If there is some error in configuration file then you can understand it by running this command –
nginx -t -c /etc/nginx/nginx.conf
Once you find the bug, you can resolve it and then restart the nginx server –
sudo service nginx restart
Conclusion
In this article we saw various reasons for error “nginx: failed to start high performance web server and a reverse proxy server”. In your case, the reason could be different but solution will be one of our provided ones.
This is Akash Mittal, an overall computer scientist. He is in software development from more than 10 years and worked on technologies like ReactJS, React Native, Php, JS, Golang, Java, Android etc. Being a die hard animal lover is the only trait, he is proud of.
Related Tags
- Error,
- nginx
Прошу помощи с решением проблемы.
Вероятно где-то ошибся и накосячил.
Мы меняем местами сервера — боевой и копию.
Чтобы хватало места под папку upload (на боевом нет возможности расширить).
Попробовали добавить поддомен на копию (была some.copy.site.ru — добавили some.copy2.site.ru), чтобы потом some.copy.site.ru перенести туда где сейчас боевой, а some.copy2.site.ru заменить на some.site.ru — сделать боевым.
Стали отрываться оба поддомена ведущий на один портал. Один по https, другой по http.
При попытке добавить SSL на второй поддомен — всё сломалось.
Теперь nginx не стартует.
# systemctl start nginx.service
Job for nginx.service failed because the control process exited with error code. See «systemctl status nginx.service» and «journalctl -xe» for details.
# systemctl status nginx.service
● nginx.service — nginx — high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2022-01-07 13:02:55 +04; 46s ago
Docs: http://nginx.org/en/docs/
Process: 11094 ExecStartPre=/usr/sbin/nginx -t -c /etc/nginx/nginx.conf (code=exited, status=1/FAILURE)
Jan 07 13:02:55 centos-79-64-minimal systemd[1]: Starting nginx — high performance web server…
Jan 07 13:02:55 centos-79-64-minimal nginx[11094]: nginx: [emerg] cannot load certificate «/etc/letsencrypt/live/some….
Jan 07 13:02:55 centos-79-64-minimal nginx[11094]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jan 07 13:02:55 centos-79-64-minimal systemd[1]: nginx.service: control process exited, code=exited status=1
Jan 07 13:02:55 centos-79-64-minimal systemd[1]: Failed to start nginx — high performance web server.
Jan 07 13:02:55 centos-79-64-minimal systemd[1]: Unit nginx.service entered failed state.
Jan 07 13:02:55 centos-79-64-minimal systemd[1]: nginx.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
# journalctl -xe
—
— Unit session-178.scope has finished starting up.
—
— The start-up result is done.
Jan 07 13:05:01 centos-79-64-minimal systemd[1]: Started Session 179 of user root.
— Subject: Unit session-179.scope has finished start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
—
— Unit session-179.scope has finished starting up.
—
— The start-up result is done.
Jan 07 13:05:01 centos-79-64-minimal systemd[1]: Started Session 180 of user bitrix.
— Subject: Unit session-180.scope has finished start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
—
— Unit session-180.scope has finished starting up.
—
— The start-up result is done.
Jan 07 13:05:01 centos-79-64-minimal CROND[11297]: (root) CMD (/opt/webdir/bin/restart_httpd-scale.sh process)
Jan 07 13:05:01 centos-79-64-minimal CROND[11298]: (root) CMD (/opt/webdir/bin/update_network.sh eno1)
Jan 07 13:05:01 centos-79-64-minimal CROND[11299]: (bitrix) CMD (test -f /home/bitrix/www/bitrix/modules/main/tools/cronJan 07 13:05:01 centos-79-64-minimal CROND[11300]: (bitrix) CMD (/usr/bin/php -f /home/bitrix/www/bitrix/php_interface/cJan 07 13:05:01 centos-79-64-minimal systemd[1]: Removed slice User Slice of bitrix.
— Subject: Unit user-600.slice has finished shutting down
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
—
— Unit user-600.slice has finished shutting down.
Jan 07 13:05:05 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:07 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:08 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:09 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:12 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:13 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:13 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:13 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:16 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:17 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:18 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:21 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:22 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:26 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:27 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:31 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:31 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:35 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:aJan 07 13:05:39 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:alines 2397-2445/2445 (END)
—
— Unit session-178.scope has finished starting up.
—
— The start-up result is done.
Jan 07 13:05:01 centos-79-64-minimal systemd[1]: Started Session 179 of user root.
— Subject: Unit session-179.scope has finished start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
—
— Unit session-179.scope has finished starting up.
—
— The start-up result is done.
Jan 07 13:05:01 centos-79-64-minimal systemd[1]: Started Session 180 of user bitrix.
— Subject: Unit session-180.scope has finished start-up
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
—
— Unit session-180.scope has finished starting up.
—
— The start-up result is done.
Jan 07 13:05:01 centos-79-64-minimal CROND[11297]: (root) CMD (/opt/webdir/bin/restart_httpd-scale.sh process)
Jan 07 13:05:01 centos-79-64-minimal CROND[11298]: (root) CMD (/opt/webdir/bin/update_network.sh eno1)
Jan 07 13:05:01 centos-79-64-minimal CROND[11299]: (bitrix) CMD (test -f /home/bitrix/www/bitrix/modules/main/tools/cron_events.php && { /usr/bin/php -f /home/bitrix/www/bitrix/modules/main/tools/cron_events.php; } >/dev/null 2>&1)
Jan 07 13:05:01 centos-79-64-minimal CROND[11300]: (bitrix) CMD (/usr/bin/php -f /home/bitrix/www/bitrix/php_interface/cron_events.php)
Jan 07 13:05:01 centos-79-64-minimal systemd[1]: Removed slice User Slice of bitrix.
— Subject: Unit user-600.slice has finished shutting down
— Defined-By: systemd
— Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
—
— Unit user-600.slice has finished shutting down.
Jan 07 13:05:05 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=36237 PROTO=TCP SPT=55875 DPT=21583 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:07 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=79.124.62.78 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=248 ID=7191 PROTO=TCP SPT=58659 DPT=63767 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:08 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=35939 PROTO=TCP SPT=55875 DPT=48721 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:09 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=36237 PROTO=TCP SPT=55875 DPT=21583 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:12 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.196.61 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=248 ID=31284 PROTO=TCP SPT=50389 DPT=3404 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:13 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=35939 PROTO=TCP SPT=55875 DPT=48721 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:13 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=45.143.203.12 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=249 ID=10514 PROTO=TCP SPT=45923 DPT=44393 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:13 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=36237 PROTO=TCP SPT=55875 DPT=21583 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:16 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.86 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=64158 PROTO=TCP SPT=45993 DPT=48560 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:17 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=35939 PROTO=TCP SPT=55875 DPT=48721 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:18 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=55945 PROTO=TCP SPT=55875 DPT=33344 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:21 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=35939 PROTO=TCP SPT=55875 DPT=48721 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:22 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=55945 PROTO=TCP SPT=55875 DPT=33344 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:26 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=26020 PROTO=TCP SPT=55875 DPT=43080 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:27 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=55945 PROTO=TCP SPT=55875 DPT=33344 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:31 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=26020 PROTO=TCP SPT=55875 DPT=43080 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:31 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=55945 PROTO=TCP SPT=55875 DPT=33344 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:35 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=26020 PROTO=TCP SPT=55875 DPT=43080 WINDOW=1024 RES=0x00 SYN URGP=0
Jan 07 13:05:39 centos-79-64-minimal kernel: Firewall: *TCP_IN Blocked* IN=eno1 OUT= MAC=24:4b:fe:b9:3e:2c:b4:8a:5f:36:a7:92:08:00 SRC=92.63.197.5 DST=162.55.239.104 LEN=40 TOS=0x00 PREC=0x00 TTL=250 ID=26020 PROTO=TCP SPT=55875 DPT=43080 WINDOW=1024 RES=0x00 SYN URGP=0
# nginx -t
nginx: [emerg] cannot load certificate «/etc/letsencrypt/live/some.copy2.site.ru/fullchain.pem»: BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen(‘/etc/letsencrypt/live/some.copy2.site.ru/fullchain.pem’,’r’) error:2006D080:BIO routines:BIO_new_file:no such file)
nginx: configuration file /etc/nginx/nginx.conf test failed
Попытки переименовать WWW в папке HOME и установить по новой не помогают.
Буду признателен за помощь!
I recently tried to install LetsEncrypt certificate, but I couldn’t start nginx again. when I run the command service nginx status
.
I get this error message:
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 Tue 2018-02-20 16:17:49 CET; 8min
ago
Process: 1439 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on;
master_process on; (code=exited, status=1/FAILURE)
Feb 20 16:17:47 django-s-1vcpu-1gb-lon1-01 systemd[1]: Starting A high performance web server and a reverse proxy server...
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 nginx[1439]: nginx: [emerg] "location" directive is not allowed here in /etc/nginx/nginx.conf:87
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 nginx[1439]: nginx: configuration file /etc/nginx/nginx.conf test failed
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 systemd[1]: nginx.service: Control process exited, code=exited status=1
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 systemd[1]: Failed to start A high performance web server and a reverse proxy server.
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 systemd[1]: nginx.service: Unit entered failed
Feb 20 16:17:49 django-s-1vcpu-1gb-lon1-01 systemd[1]: nginx.service: Failed with result 'exit-code'.
And here is /etc/nginx/sites-avalible/django
:
upstream app_server {
server unix:/home/django/gunicorn.socket fail_timeout=0;
}
server {
#listen 80 default_server;
#listen [::]:80 default_server ipv6only=on;
listen 443 ssl;
server_name nettside.no;
ssl_certificate /etc/letsencrypt/live/nettside.no/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/nettside.no/privkey.pem;
root /usr/share/nginx/html;
index index.html index.htm;
client_max_body_size 4G;
server_name nettside.no;
keepalive_timeout 5;
# Your Django project's media files - amend as required
location /media {
alias /home/django/django_project/django_project/media;
}
# your Django project's static files - amend as required
location /static {
alias /home/django/django_project/static;
}
# Proxy the static assests for the Django Admin panel
location /static/admin {
alias /home/django/django_project/static/admin;
}
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_buffering off;
proxy_pass http://app_server;
}
}
server {
listen 80;
server_name nettside.no;
return 301 https://$host$request_uri;
}
systemctl status nginx.service outputs:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2019-01-23 19:04:12 +03; 1min 1s ago
Docs: man:nginx(8)
Process: 10511 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Jan 23 19:04:12 linux systemd[1]: Starting A high performance web server and a reverse proxy server...
Jan 23 19:04:12 linux nginx[10511]: nginx: [emerg] a duplicate default server for [::]:80 in /etc/nginx/sites-enabled/default:23
Jan 23 19:04:12 linux nginx[10511]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jan 23 19:04:12 linux systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jan 23 19:04:12 linux systemd[1]: nginx.service: Failed with result 'exit-code'.
Jan 23 19:04:12 linux systemd[1]: Failed to start A high performance web server and a reverse proxy server.
journalctl -xe outputs:
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- An ExecStartPre= process belonging to unit nginx.service has exited.
--
-- The process' exit code is 'exited' and its exit status is 1.
Jan 23 19:10:15 linux systemd[1]: nginx.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- The unit nginx.service has entered the 'failed' state with result 'exit-code'.
Jan 23 19:10:15 linux 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: https://www.debian.org/support
--
-- A start job for unit nginx.service has finished with a failure.
--
-- The job identifier is 2656 and the job result is failed.
Jan 23 19:10:15 linux sudo[10625]: pam_unix(sudo:session): session closed for user root
Jan 23 19:10:23 linux sudo[10631]: lvlzyro : TTY=pts/0 ; PWD=/home/lvlzyro ; USER=root ; COMMAND=/usr/bin/journalctl -xe
Jan 23 19:10:23 linux sudo[10631]: pam_unix(sudo:session): session opened for user root by (uid=0)
nginx.conf:
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
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_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/*;
}
#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}
What should I do to fix it? Thanks for your attention btw.