Page 1 of 1

[SOLVED] Apache works fine locally but not on the net

PostPosted: Nov 13th, '12, 19:23
by wilcal
I'm not all that up to speed on configuring Apache
so I'm probably more looking for where to ask this
question. As has been discussed here there is a big
difference between Apache on M2 ( ver 2.2.23 ) and
that which is on M3 ( ver 2.4.3 ). M1 & M2 had the
drakwizard tool which allowed one to quickly and
easily configure both Proftp and Apache. Apparently
Drakwizard is no longer supported and Mageia has
decided to let Proftp and Apache users configure
these on their own. IMO this is a significant loss in
usability that Mandrake/Mandriva/Mageia 1/2 featured.
Aside from that Apache and Proftp are easily,
and manually, installed by:

MCC -> Install & Remove Software -> select:

apache
apache-mod_userdir
proftp

All the necessary RPMs will get installed and both
Apache ( httpd ) and Proftp ( proftpd ) will be
properly installed. If you then go to:

System -> Manage system services

and "Start" httpd and proftpd those two services
will start and be usable on the local LAN. Each user
on the new M3 box can create a public_html folder
and put their website in there. Those "websites"
can be accessed by any box on the LAN. Lets say
the new M3 box is at 192.168.1.2 then an M2 box
at 192.168.1.4 can select say:

192.168.1.2/~wilcal/

and visit the website.

drakwizard had as part of its Apache install feature
the check-boxes:

Enable the web server for the Internet ( not checked by default )

It also has

Enable the web server for the Intranet ( checked by default )

Since drakwizard does not work for M3 "webserver for
the Internet" does not work. But, the Intranet
works just fine.

Does anyone here have any experience setting
up Apache 2.4.3 and what they had to change in
the configure files to allow a Mageia M3 system
with Apache 2.4.3 installed and is accessible on
the Internet.

The box I am testing this on has a successful
and long running, up-to-date, Mageia M2 Apache
webserver. It works on both the Inter and Intra
Nets.

Thanks for any thoughts.

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 13th, '12, 20:07
by filip
Try to add this:
Code: Select all
<Directory "/path/to/root/of/your/php/files">
    AllowOverride None
    # Allow open access:
    Require all granted
</Directory>


I think you can add them as many as you need.

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 14th, '12, 19:18
by wilcal
filip wrote:Try to add this....

I think you can add them as many as you need.

Many thanks for the info. I have altered the httpd.conf
code as you suggested and that did not allow for external
access to the server. LAN access still is ok. Any more
thoughts are much appreciated. I'm gonna post the same
question of several of the Apache speciflc forums.

Thanks again.

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 14th, '12, 19:28
by oj
Is the IP address the same as it was with the prior (working) setup? Obviously you have forwarded port 80 through whatever internet-facing router you have to that machine. If your new M3 has obtained a different IP than the previous setup used your forwarding on the router/firewall would have to be changed.

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 14th, '12, 19:57
by doktor5000
BTW, what does the httpd.conf say at all, on which interfaces does Apache listen?

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 15th, '12, 18:11
by wilcal
doktor5000 wrote:BTW, what does the httpd.conf say at all, on which interfaces does Apache listen?

To answer both oj's and doktor5000's questions
because my ISP, Cox, does not allow live Port 80
webservers on consumer connections I am using Port 8080.
You can actually visit the live server here:

http://72.220.228.245:8080/~wilcal/

http://72.220.228.245:8080

The port is forwarded by the Router to this box.
Feel free to visit.

This is a Mageia 2 system that has worked, and been
on line, since June 2012. It works just fine. This
system also features a removable replaceable hard
drive system. I pull out the working M2 drive and
slip in the M3 test drive. M3 works on the LAN
but the above IP's do not respond. The LAN IP, 192.168.1.2,
is locked to the MoBo of this box by the Router and
that does not change with the swapping of the HD.

I/We have a LOT of time to work on this one. It just has
to be something very simple. At this point I'm believing
it's something in the /etc/httpd/httpd.conf file that I
don't understand. I've posted this question in a couple
of official Apache forums but so far detailed info on
Apache 2.4.3 httpd.conf does not seem to be forth coming.
I also see a lot of stress over 2.4.3 there. It is apparently
new and a big change.

In the next days I am going to go back to M2 and
using drakwizard install Apache without the
Internet option checked. Copy that httpd.conf
then re-setup Apache with drakwizard checking
the Internet option. Then comparing the two
httpd.conf files to see what drakwizard changes.
At least this will give me an idea what was
going on there. Apache 2.4.3 httpd.conf file
is different then 2.2.23 httpd.conf file.

At some point, when I understand enough about this,
I'll open a bug report if I don't find a work around.
Maybe you can put me in touch with the Mageia Apache
maintainer.

Many thanks to all for your thoughts.

Here's the port Code in the m3 httpd.conf:
Code: Select all
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, instead of 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.
#
Listen 8080

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 15th, '12, 18:55
by oj
Maybe a dumb question, but when testing internet connectivity are you actually outside your own LAN? I wonder if restarting everything from the cable modem/DSL/whatever, all switches/routers and then computers would help. Might be something stuck in a routing table or ARP cache somewhere.

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 15th, '12, 21:46
by wilcal
oj wrote:Maybe a dumb question, but when testing internet connectivity are you actually outside your own LAN? I wonder if restarting everything from the cable modem/DSL/whatever, all switches/routers and then computers would help. Might be something stuck in a routing table or ARP cache somewhere.

Thanks for the tip. I'll try that. Do note that when I swap out the
working drive ( M2 ) with the test drive ( M3 ) the system is restarted.
This is a cable modem then a Netgear router. Next time I test
I'll take everything down then bring back the cable modem, then
the router then boot the M3 test system.

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 15th, '12, 21:51
by wilcal
oj wrote:Maybe a dumb question, but when testing internet connectivity are you actually outside your own LAN?

The test box is the working system. It is on the LAN inside the Netgear Router.
The Router always serves the same IP ( 192.168.1.2 ) and the Router
Port forwards Port 8080 to 192.168.1.2. Do also note that this same
system ran Mageia 1 for an entire year and the switch over to Mageia 2
was seamless with no problems at all.

Re: Apache ( httpd ) works fine locally but not on the net

PostPosted: Nov 15th, '12, 22:02
by wilcal
Am I maybe the first person to try and bring a
Mageia 3 ( Cauldron ) webserver up on the Net??? :o

[SOLVED] Apache ( httpd ) works fine locally but not on the

PostPosted: Nov 16th, '12, 02:17
by wilcal
I have in fact figured this out.

The difference between apache httpd.conf ver 2.2.23 as used in Mageia 1/2
and ver 2.4.3 as used in Mageia 3 ( cauldron ) is considerable. There
are in fact many places I found within the Apache community forums helping
people understand the changes and how to implement them. Last thing I wanted
to do was to try to understand this complex application, but, what the heck.
In the end, as I suspected, the solution to get your local M3 httpd webserver
on the net was pretty simple.

Installation of Apache into M3 is simple:

MCC -> Install & Remove Software -> select:

apache
apache-mod_userdir ( allows individual users on the system to host their own websites on dir public_html )

and it installs.

That install creates /etc/httpd/conf/httpd.conf

Line 42 of httpd.conf is the listening port and that is set to default to 80.
Because of my setup I change that to 8080.

Around line 100 add a block of new code such that it looks like this:

#
# Deny access to the entirety of your server's filesystem. You must
# explicitly permit access to web content directories in other
# <Directory> blocks below.
#
<Directory />
AllowOverride none
Require all denied
</Directory>

<Directory /home>
AllowOverride none
Require all granted
</Directory>

This allows all the individual users to have a public_html directory that is made available on the Internet.
The "Require all granted" command I think is new to Apache 2.4.3. As expected it was a pretty simple fix.

I think I could add

<Directory /home/user/public_html>
AllowOverride none
Require all granted
</Directory>

blocks to refine the selection as needed. If anyone has any input
as to the security of all this your input would be greatly appreciated.
I am NOT an expert on configuring Apache ( httpd.conf ) just kind of
a hunt a peck guy.

Thanks to all for help on this one.