Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED-reinstalled] Apache cannot find listening socket
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
SxN
Apprentice
Apprentice


Joined: 08 Jan 2007
Posts: 158
Location: Toronto, ON, Canada

PostPosted: Wed Mar 12, 2014 4:15 am    Post subject: [SOLVED-reinstalled] Apache cannot find listening socket Reply with quote

Hi,

Cannot start Apache; tried
Code:
/etc/init.d/apache2 start


and also directly:
Code:
/usr/sbin/apache2
no listening sockets available, shutting down
Unable to open logs


There is no indication in logs of what can be wrong (maybe because it couldn't open them?). I ensured that all log files in /var/log/apache2 are rw-rw-rw-, but it made no difference.

Other few things:
Code:
grep -w 80 /etc/services
http         80/tcp         www www-http      # World Wide Web HTTP
http         80/udp         www www-http

/usr/sbin/apache2 -t
Syntax OK


What should I try to go over this one?

Thanks,
SxN


Last edited by SxN on Wed Mar 19, 2014 4:29 pm; edited 1 time in total
Back to top
View user's profile Send private message
gotyaoi
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2013
Posts: 94

PostPosted: Wed Mar 12, 2014 4:38 am    Post subject: Reply with quote

Post the output of
Code:
netstat -nlpt
please. Also, what do you have apache set to listen on in httpd.conf, ie. post any "Listen" directives in there or in Include'd conf files.
Back to top
View user's profile Send private message
SxN
Apprentice
Apprentice


Joined: 08 Jan 2007
Posts: 158
Location: Toronto, ON, Canada

PostPosted: Wed Mar 12, 2014 5:49 am    Post subject: Reply with quote

Code:
# netstat -nlpt
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:6000          0.0.0.0:*               LISTEN        25770/X

# cd /
# grep -r "Listen" *
... skipping comments, binaries etc ...
etc/apache2/vhosts.d/00_default_ssl_vhost.conf:Listen 443
etc/apache2/vhosts.d/00_default_vhost.conf:Listen 80
Back to top
View user's profile Send private message
gotyaoi
Tux's lil' helper
Tux's lil' helper


Joined: 01 Apr 2013
Posts: 94

PostPosted: Wed Mar 12, 2014 7:53 am    Post subject: Reply with quote

Hmm, backing up for a moment then, you are trying to start apache as root, yes? Not as a normal user?
Back to top
View user's profile Send private message
SxN
Apprentice
Apprentice


Joined: 08 Jan 2007
Posts: 158
Location: Toronto, ON, Canada

PostPosted: Wed Mar 12, 2014 2:52 pm    Post subject: Reply with quote

Yes, root
Back to top
View user's profile Send private message
SxN
Apprentice
Apprentice


Joined: 08 Jan 2007
Posts: 158
Location: Toronto, ON, Canada

PostPosted: Sat Mar 15, 2014 4:14 pm    Post subject: Reply with quote

Being an Apache novice, it took me a while to understand that I was missing /etc/apache2/apache2.conf. Now it is there, though am not sure it is right. Or it may be something else wrong, because:
- when starting, Apache complains that it could not determine the servers fully qualified domain name, although my last line in that configuration file states
Code:
ServerName=localhost

- then it reports that it fails to start
- despite that, it seems to work at some level, servicing browsers
- there is a twist though: the service provided is not correct. My experimental index.html file looks like this
Code:
<html><body>Hello</body></html>

Browsers show this:
Code:
<html><body>Hello</body></html>

Had a look with Firebug in what is delivered to the browser, and here is the code:
Code:
<html>
<head>
<link title="Wrap Long Lines" href="resource://gre-resources/plaintext.css" type="text/css" rel="alternate stylesheet">
</head>
<body>
<pre><html><body>Hello</body></html> </pre>
</body>
</html>


My original file content is treated as text!

Where should I look to remedy my situation?

Thanks
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1238
Location: 42.68n 85.41w

PostPosted: Sun Mar 16, 2014 9:51 am    Post subject: Reply with quote

remove pre tags....

kazam@kazam [ ~ ] $ cat /var/www/localhost/htdocs/index.html
<head>
<link rel="stylesheet" type="text/css" href="index.css">
</head>
<html><body><h1>It works!</h1></body></html>
my index.css is right next to index.html

remove ServerName=localhost /etc/hosts determines that

root@vegas [ ~ ]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using thecpamatrix.com for ServerName
[ OK ]

#162.248.5.86 thecpamatrix.com www.thecpamatrix thecpamatrix www.thecpamatrix.com
remove # &

root@vegas [ ~ ]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

welcome, have a good day & good luck! :D
_________________
cat /etc/*-release
Funtoo Linux - baselayout 2.2.0
consider this warning no. 1
https://wiki.gentoo.org/index.php?title=Special:Contributions/666threesixes666&offset=&limit=500&target=666threesixes666
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 9009

PostPosted: Sun Mar 16, 2014 5:26 pm    Post subject: Reply with quote

SxN wrote:
Browsers show this:
Code:
<html><body>Hello</body></html>

Had a look with Firebug in what is delivered to the browser, and here is the code:
Code:
<html>
<head>
<link title="Wrap Long Lines" href="resource://gre-resources/plaintext.css" type="text/css" rel="alternate stylesheet">
</head>
<body>
<pre><html><body>Hello</body></html> </pre>
</body>
</html>


My original file content is treated as text!
Firebug reports weird things when you try to analyze a text/plain document as though it were text/html. I suspect that Firefox internally converted it to an appropriately wrapped text/html document, which is why you have the reference to a resource:// object.

Your problem is that the server is reporting a MIME type of text/plain instead of text/html. I do not know why, but hopefully this points you in the right direction for further research.
Back to top
View user's profile Send private message
SxN
Apprentice
Apprentice


Joined: 08 Jan 2007
Posts: 158
Location: Toronto, ON, Canada

PostPosted: Tue Mar 18, 2014 12:26 pm    Post subject: Reply with quote

666 - I don't have a <pre> in my original file; it is inserted automatically

Hu - I think the same, and am pouring through the documentation of every module, to try to determine if I'm missing one


Meanwhile, by tweaking with the configuration files, I got rid of all the error messages, except "apache failed to start" (but in fact, it is started). There is, for sure, some issue that Apache tries to go around, shown by the long loading time.

I also subscribed to an Apache forum, awaiting moderator approval to join and ask there for some pointers too.

Thanks for your suggestions, and let them come,
SxN
Back to top
View user's profile Send private message
SxN
Apprentice
Apprentice


Joined: 08 Jan 2007
Posts: 158
Location: Toronto, ON, Canada

PostPosted: Wed Mar 19, 2014 2:44 am    Post subject: Reply with quote

I created a little .htaccess beside index.html, with the following content:

Code:
AddHandler text/html .html   


Trying now to access index.html, I got a 500 Internal Server Error (in the form of an HTML source code). A quick check in log gives this:

Code:
Invalid command 'AddHandler', perhaps misspelled or defined by a module not included in the server configuration.


Well, httpd.conf has this line:

Code:
LoadModule mime_module modules/mod_mime.so



Earlier I tried to use AddType instead of AddHandler, with the same results.

Bogs my mind, what may be going on?

Thanks
Back to top
View user's profile Send private message
666threesixes666
Veteran
Veteran


Joined: 31 May 2011
Posts: 1238
Location: 42.68n 85.41w

PostPosted: Wed Mar 19, 2014 4:20 am    Post subject: Reply with quote

<IfModule mod_garbage.c>
SomeSexy garbage directive
</IfModule>

:twisted: good luck on thy quest!
_________________
cat /etc/*-release
Funtoo Linux - baselayout 2.2.0
consider this warning no. 1
https://wiki.gentoo.org/index.php?title=Special:Contributions/666threesixes666&offset=&limit=500&target=666threesixes666
Back to top
View user's profile Send private message
SxN
Apprentice
Apprentice


Joined: 08 Jan 2007
Posts: 158
Location: Toronto, ON, Canada

PostPosted: Wed Mar 19, 2014 4:28 pm    Post subject: Reply with quote

Fixed the problem:
Code:
emerge --unmerge apache


then downloaded the latest from www.apache.org and installed that. 10 or 15 minutes later I was on :))

SxN
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum