LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Problem in Apache setup (http://www.linuxquestions.org/questions/linux-server-73/problem-in-apache-setup-4175452131/)

mahmoodn 02-28-2013 03:44 PM

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.

bathory 02-28-2013 05:06 PM

Hi,

What happens if you visit http://132.216.61.14/

Habitual 02-28-2013 05:31 PM

n/m. Sorry.

mahmoodn 02-28-2013 10:21 PM

Quote:

Originally Posted by bathory (Post 4901925)
Hi,

What happens if you visit http://132.216.61.14/

It says connection timed out

fortran 03-01-2013 12:07 AM

Have you defined this ServerName in /etc/hosts file?

bathory 03-01-2013 01:23 AM

Quote:

Originally Posted by mahmoodn (Post 4902055)
It says connection timed out

If it says so, then check your firewall and make sure port 80 is open.

Regards

mahmoodn 03-01-2013 02:16 AM

Quote:

Originally Posted by pavi_kanetkar (Post 4902113)
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 (Post 4902164)
If it says so, then check your firewall and make sure port 80 is open.
Regards

How can I check that?

bathory 03-01-2013 03:00 AM

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

mahmoodn 03-01-2013 03:06 AM

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?

bathory 03-01-2013 03:32 AM

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

mahmoodn 03-01-2013 04:12 AM

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

mahmoodn 03-01-2013 04:38 AM

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

mahmoodn 03-01-2013 04:51 AM

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


All times are GMT -5. The time now is 08:02 PM.