LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-17-2017, 04:32 AM   #1
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Rep: Reputation: 11
Post Why Nginx can't run?


Hello.
I installed "nginx" on CentOS 7 x64 but it can't run. why?
Code:
[root@localhost ~]# service nginx status -l
Redirecting to /bin/systemctl status  -l nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sat 2017-06-17 06:24:38 EDT; 1min 52s ago
  Process: 9221 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
  Process: 9217 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 9214 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

Jun 17 06:24:36 localhost.localdomain nginx[9221]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jun 17 06:24:36 localhost.localdomain nginx[9221]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jun 17 06:24:37 localhost.localdomain nginx[9221]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jun 17 06:24:37 localhost.localdomain nginx[9221]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jun 17 06:24:38 localhost.localdomain nginx[9221]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
Jun 17 06:24:38 localhost.localdomain nginx[9221]: nginx: [emerg] still could not bind()
Jun 17 06:24:38 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
Jun 17 06:24:38 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
Jun 17 06:24:38 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
Jun 17 06:24:38 localhost.localdomain systemd[1]: nginx.service failed.
The output of "netstat -tulpn" tell me:
Code:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      9093/nginx: master  
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      30584/sshd          
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2723/master         
tcp        0      0 127.0.0.1:9051          0.0.0.0:*               LISTEN      5272/ssh            
tcp6       0      0 127.0.0.1:9200          :::*                    LISTEN      5894/java           
tcp6       0      0 ::1:9200                :::*                    LISTEN      5894/java           
tcp6       0      0 127.0.0.1:9300          :::*                    LISTEN      5894/java           
tcp6       0      0 ::1:9300                :::*                    LISTEN      5894/java           
tcp6       0      0 :::22                   :::*                    LISTEN      30584/sshd          
tcp6       0      0 ::1:25                  :::*                    LISTEN      2723/master
Thank you.

Last edited by hack3rcon; 06-17-2017 at 04:36 AM.
 
Old 06-17-2017, 06:03 AM   #2
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Problem solved by reboot the system but I can't see the default nginx page when I browse the IP.
Code:
$ curl -X get http://localhost:80
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
 
Old 06-18-2017, 03:11 AM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by hack3rcon View Post
Problem solved by reboot the system but I can't see the default nginx page when I browse the IP.
Code:
$ curl -X get http://localhost:80
<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
That's because you have to use capital letters for the request:
Code:
curl -X GET http://localhost:80
Cheers
 
Old 06-18-2017, 05:35 AM   #4
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Quote:
Originally Posted by bathory View Post
That's because you have to use capital letters for the request:
Code:
curl -X GET http://localhost:80
Cheers
As I said, I can't see the default Nginx page !!!
Code:
# curl -X GET http://localhost:80
<html>
<head><title>401 Authorization Required</title></head>
<body bgcolor="white">
<center><h1>401 Authorization Required</h1></center>
<hr><center>nginx/1.10.2</center>
</body>
</html>
 
Old 06-18-2017, 06:23 AM   #5
hack3rcon
Senior Member
 
Registered: Jan 2015
Posts: 1,432

Original Poster
Rep: Reputation: 11
Problem solved by adding two rules about ports 455 and 80 via "firewalld".
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NGINX + nginx-rtmp-module + HLS + OBS Manoel Júnior Linux - Server 0 08-10-2016 05:45 AM
[SOLVED] NGINX connect() to unix:/var/run/php5-fpm/forums.socket failed roo4 Linux - Server 2 12-05-2013 12:52 AM
Nginx experts help me-problem when using Nginx php-fpm !!! HuMan-BiEnG Linux - Server 2 04-17-2011 02:30 PM
NGINX with PHP-FPM vis NGINX with Spawn-FCGI WhisperiN Linux - Server 1 03-15-2011 06:39 PM
LXer: How to install Nginx to run Drupal with boost, on an Arch Linux server LXer Syndicated Linux News 0 04-16-2010 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 10:12 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration