LinuxQuestions.org
Visit the LQ Articles and Editorials section
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 02-28-2013, 02:44 PM   #1
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Rep: Reputation: 16
Problem in Apache setup


I have installed Apache using this guide http://dev.antoinesolutions.com/apache-server
and defined a VirtualHost like this in /etc/httpd/conf/httpd.conf

Code:
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html/munin
    ServerName 132.216.61.14
    ErrorLog logs/dummy-host.example.com-error_log
    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
That folder is not empty:
Code:
[root@srv mahmood]# ls /var/www/html/munin/
disk-day.html    network-day.html    postfix-month.html   printing-week.html    processes-week.html  system-week.html
disk-month.html  network-month.html  postfix-week.html    printing-year.html    processes-year.html  system-year.html
disk-week.html   network-week.html   postfix-year.html    problems.html         static               tiger
disk-year.html   network-year.html   printing-day.html    processes-day.html    system-day.html
index.html       postfix-day.html    printing-month.html  processes-month.html  system-month.html
Now, when I restart the httpd, there is no complain about virtualhost
Code:
[root@srv mahmood]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.1.5 for ServerName
                                                           [  OK  ]
However still can not see the web page.

I have to say, I didn't enter localhost in the browser because I am connecting to the remote machine via putty. The machine has two network interfaces, one is internal and the other is connected
to internet.

Last edited by mahmoodn; 02-28-2013 at 02:46 PM.
 
Old 02-28-2013, 04:06 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,894

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Hi,

What happens if you visit http://132.216.61.14/
 
Old 02-28-2013, 04:31 PM   #3
Habitual
Senior Member
 
Registered: Jan 2011
Distribution: Slack14_64_Multilib
Posts: 3,058
Blog Entries: 4

Rep: Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740Reputation: 740
n/m. Sorry.
 
Old 02-28-2013, 09:21 PM   #4
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by bathory View Post
Hi,

What happens if you visit http://132.216.61.14/
It says connection timed out
 
Old 02-28-2013, 11:07 PM   #5
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 269
Blog Entries: 2

Rep: Reputation: 48
Have you defined this ServerName in /etc/hosts file?
 
Old 03-01-2013, 12:23 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,894

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Quote:
Originally Posted by mahmoodn View Post
It says connection timed out
If it says so, then check your firewall and make sure port 80 is open.

Regards
 
Old 03-01-2013, 01:16 AM   #7
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by pavi_kanetkar View Post
Have you defined this ServerName in /etc/hosts file?
Here is the output.
Code:
$ cat /etc/hosts
127.0.0.1               localhost.localdomain localhost
#::1            localhost6.localdomain6 localhost6
192.168.1.5    tiger
132.216.61.14  tiger
Is it OK?

Quote:
Originally Posted by bathory View Post
If it says so, then check your firewall and make sure port 80 is open.
Regards
How can I check that?
 
Old 03-01-2013, 02:00 AM   #8
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,894

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Quote:
How can I check that?
You didn't say your distro, but in general you can run from CLI
Code:
iptables -nvL
to see what ports are open in your firewall
 
Old 03-01-2013, 02:06 AM   #9
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
It is Scientific linux 6.3 which is based on Redhat. All centos, fedora and redhat solutions are applicable.

Code:
[root@srv mahmood]# iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
 155M  973G ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
   62  5151 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0
42039 2523K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
  322 19040 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
94673   19M REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 118M packets, 6932M bytes)
 pkts bytes target     prot opt in     out     source               destination
[root@srv mahmood]#
This output seems to be ok. Right?
 
Old 03-01-2013, 02:32 AM   #10
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,894

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
So port 80 is closed.
I'm not running SL, but you may follow the instructions here to open the port in iptables. It's written for Centos, but it can apply to SL as it's compatible with Centos

Regards
 
Old 03-01-2013, 03:12 AM   #11
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
OK. According to the comments, the correct syntax for me is

Code:
[root@tiger mahmood]# cat /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
-A INPUT -m state –-state NEW -m tcp -p tcp –-dport 80 -j ACCEPT
-A INPUT -m state –-state NEW -m tcp -p tcp –-dport 443 -j ACCEPT
COMMIT
The I restart the service
Code:
[root@tiger mahmood]# service iptables restart
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]
And the iptables shows good thing
Code:
[root@tiger mahmood]# iptables -nvL
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
  140 54559 ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED
    0     0 ACCEPT     icmp --  *      *       0.0.0.0/0            0.0.0.0/0
   12   732 ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
    1    60 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22
   37  2361 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:80
    0     0 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:443

Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 REJECT     all  --  *      *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT 152 packets, 56436 bytes)
 pkts bytes target     prot opt in     out     source               destination
However still I can not view the webpage

Last edited by mahmoodn; 03-01-2013 at 03:25 AM.
 
Old 03-01-2013, 03:38 AM   #12
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
OK. The trick is explained here http://stackoverflow.com/questions/9...see-my-website

Now the problem is, as I enter the IP in the browser, it needs a user password. Otherwise I receive unauthorized message
 
Old 03-01-2013, 03:51 AM   #13
mahmoodn
Member
 
Registered: May 2010
Posts: 400

Original Poster
Rep: Reputation: 16
OK. As a final update to this thread, I followed the guide http://www.electrictoolbox.com/apach...-subdirectory/ and now I can see the munin page without password
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Webmail setup problem in Thunderbird - Hotmail and Yahoo setup arindom Linux - Software 7 03-25-2008 11:27 AM
Apache Server setup problem... crillegs Linux - Software 5 05-23-2006 01:57 PM
apache setup problem aw_wolfe Linux - Newbie 3 04-21-2005 06:27 PM
apache or php setup problem caged Linux - Software 2 10-28-2004 06:29 PM
Apache setup problem ne0mesis Linux - Software 0 07-13-2003 07:29 PM


All times are GMT -5. The time now is 04:23 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration