LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-13-2014, 06:43 AM   #1
turalo
Member
 
Registered: Sep 2005
Location: NL
Distribution: linux, windows,
Posts: 115

Rep: Reputation: 19
Question Make apache/httpd listen to a local IP only.


Hi guys,

I'm stuck with this problem.

I have a server that is on publick IP.

this server has only publick acces to ports 5060 and 10000-20000, voip traffic.

I have blocked all other ports from outside with IP tables.

Now, I want to make sure that the webserver/httpd listens only to IP 192.168.1.1

because I have a vpn pptpd on this server, so when I need to config something on webinterface I would make vpn connection to the server, server will give me 192.x.x.x IP, and I will be able to reach the web gui on 192.168.1.1

so when I go to /etc/httpd/conf/httpd.conf

change the listing settings to the local IP, then I get this :

root@pbx:~ $ service httpd start
Starting httpd: (99)Cannot assign requested address: make_sock: could not bind to address 192.168.1.1:9080
no listening sockets available, shutting down
Unable to open logs

this is my config :

# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the <VirtualHost>
# directive.
#
# Change this to Listen on specific IP addresses as shown below to
# prevent Apache from glomming onto all bound IP addresses (0.0.0.0)
#
#Listen 12.34.56.78:80
#Listen *:80
Listen 192.168.1.1:9080
Listen *:9080


----

just for the info.

If I comment the listen IP setting

and start httpd normally with port 9080 it works fine, but then it's vailable on public IP and also on local IP 192. so I know that my httpd works fine on defined port 9080.


please help / advise.


thanks in advance.
 
Old 10-13-2014, 12:23 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,164
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

You should make sure that you only have the following "Listen" directive in httpd.conf
Code:
Listen 192.168.1.1:9080
Regards
 
Old 10-13-2014, 03:36 PM   #3
turalo
Member
 
Registered: Sep 2005
Location: NL
Distribution: linux, windows,
Posts: 115

Original Poster
Rep: Reputation: 19
Same result.


root@localhost:~ $ service httpd start
Starting httpd: (99)Cannot assign requested address: make_sock: could not bind to address 192.168.1.1:9080
no listening sockets available, shutting down
Unable to open logs
[FAILED]
 
Old 10-14-2014, 12:42 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,164
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
These should be another "Listen...' directive directive, perhaps in an included file. You didn't say your distro, but you can run:
Code:
find /etc/httpd/conf  -type f -exec grep 9080 {} /dev/null \;
to check

You can also stop apache and run:
Code:
netstat -tanpl|grep 9080
to see if there is some other instance listening on that port
 
Old 10-14-2014, 04:25 AM   #5
turalo
Member
 
Registered: Sep 2005
Location: NL
Distribution: linux, windows,
Posts: 115

Original Poster
Rep: Reputation: 19
Quote:
Originally Posted by bathory View Post
These should be another "Listen...' directive directive, perhaps in an included file. You didn't say your distro, but you can run:
Code:
find /etc/httpd/conf  -type f -exec grep 9080 {} /dev/null \;
to check

You can also stop apache and run:
Code:
netstat -tanpl|grep 9080
to see if there is some other instance listening on that port

I have only 1 place where it's set :


root@localhost:/var/log/asterisk $ find /etc/httpd/conf -type f -exec grep 9080 {} /dev/null \;
/etc/httpd/conf/httpd.conf:#Listen 192.168.1.1:9080
/etc/httpd/conf/httpd.conf:Listen *:9080
root@localhost:/var/log/asterisk $

and no there is no other instance that listens to that port.
 
Old 10-14-2014, 08:07 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,164
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
I have only 1 place where it's set :


root@localhost:/var/log/asterisk $ find /etc/httpd/conf -type f -exec grep 9080 {} /dev/null \;
/etc/httpd/conf/httpd.conf:#Listen 192.168.1.1:9080
/etc/httpd/conf/httpd.conf:Listen *:9080
root@localhost:/var/log/asterisk $

and no there is no other instance that listens to that port.
Is that IP (192.168.1.1) the IP of your box?
What is the output of
Code:
ifconfig
 
  


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
High server load... might be this process: /usr/local/apache/bin/httpd -DSSL ajames3436 Linux - Server 4 06-19-2009 07:45 AM
make Apache-tomcat to listen to other interface the_imax Linux - Server 1 07-21-2008 08:14 AM
httpd listen 80 madwac Linux - Software 5 04-11-2008 09:01 AM
Starting httpd: /usr/sbin/httpd: symbol lookup error: /usr/local/lib/libaprutil-0.so. bijuhpd Linux - Newbie 1 10-30-2005 05:07 PM
how can i set apache httpd to listen to interface tun0 ? kublador Linux - Software 1 08-31-2004 10:14 PM

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

All times are GMT -5. The time now is 05:48 AM.

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