This site is now 100% read-only, and retired.

XML logo

Apache2 - Is it really that hard?
Posted by Grimnar on Fri 16 Nov 2007 at 11:58
After two months of hell with some hardware supplier I finally got my server back up and running.

Installing Debian went like a dream, all up to the point when I was about to install apache.
Which one to install? 1.3 og 2.2.3?
Of course, I installed both. The confusion was total. Wich php to go with this? php4 or php5?
I stopped the 1.3-server and figured I should take a step into the future and run apache 2.2.3 and learn how that works.
But holy sh** was I in for surprise. Now, I been working with apache 1.3 for about 4 years. But I cannot for the life of me get this to work. What the hell is up with this?
Why is there several folders such as sites-enabled and sites-available? Wich one should I edit to make them work? (yeah, I runned the a2ensite)

Perhaps apache2 is really made to run from a web based program?
I finally found the a2enmod php4/php5 - and thought that would make php work on my sites, but of course I was wrong. No I get a download popup asking me to download x-httpd-php. That makes it clear that php is not working.

I´ve been googling like a fanatic the last couple of days to find some starting guides and howto´s - but nothing.

1. I got a mainpage with no php on it right now, just index.html just to get it working. But I still get the php error. Even I checked everywhere and the DocumentRoot points to a folder wich have NO *.php in it.

2. Should I go back to apache 1.3? The sites I´m serving is really only galleries and light stuff like that. Is there a need for apache2? Or should I be prepared for the future and stick with apache2 and learn it once and for all?



 

Comments on this Entry

Re: Apache2 - Is it really that hard?
Posted by Steve (80.68.xx.xx) on Fri 16 Nov 2007 at 12:35
[ View Weblogs ]

We did cover this in the past in this article. In short you place your site information in sites-available - then if you want to enable the site you symlink that into sites-enabled.

(ie. Apache only reads things from sites-enabled and modules-enabled - this allows you to have sites which are disabled and modules which are disabled and you can use the new commands to turn them on and off with ease.)

In short I'd suggest you stick with Apache2. It is the way of the future and many many things are more simple with it.

If you have more specific questions, or confusion, after reading that introduction please do tell us what they are and we'll try to help..,

Steve

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by Grimnar (62.200.xx.xx) on Fri 16 Nov 2007 at 14:54
[ View Weblogs ]
Sorry about my brief ending. I spent a good 1/2 hour writing that and had to rush out for work.
I will come back later with more experience on apache2. I need to upload about 50gb backup before letting the server go live anyway.
But as for now it is the php that is bothering me, It will not work. Do I have to enable php-support in the vhost snippets as well?

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by chris (82.196.xx.xx) on Fri 16 Nov 2007 at 15:03
[ View Weblogs ]
Just to make sure - do you have both the php5 AND the libapache2-mod-php5 (or php4 and libapache2-mod-php4 - although I'd go with 5) installed?

You need the libapache bit to get the integration (I kind of think you do from the comment on a2enmod - but just to be sure .....)

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by chris (82.196.xx.xx) on Fri 16 Nov 2007 at 15:05
[ View Weblogs ]
You may also want to read http://www.debian-administration.org/articles/391 although it says much the same

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by Anonymous (213.164.xx.xx) on Sat 17 Nov 2007 at 10:45
It's one line:
aptitude install libapache2-mod-php5

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by Grimnar (62.200.xx.xx) on Sat 17 Nov 2007 at 13:35
[ View Weblogs ]
Yeah, I already got that one. But no. I will try more later tonight. Still at work:/

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by simonw (84.45.xx.xx) on Sat 17 Nov 2007 at 17:49
[ View Weblogs ]
To make the PHP work you just need the "AddType" that should be in /etc/apache2/mod-enabled/php5.conf

Don't use PHP4 or Apache 1, as every time you do another free software developers heart is broken.

Did you restart Apache after enabling modules?

The config works pretty much like Apache 1.3, except they broke it into separate files, so that they can add and remove stuff easily. The /etc/apache2/apache2.conf just includes the other files, to make one big horrid linear configuration file.

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by Grimnar (85.221.xx.xx) on Mon 19 Nov 2007 at 20:31
[ View Weblogs ]
Finally some off hours, and I get to work more on my server again. Going to try the latest tips of AddType. So as far as I can understand, it´s safe to remove php4. And only use php5. I remove apache 1.3 the other day as well. Tabbing got way quicker:D

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by Grimnar (85.221.xx.xx) on Mon 19 Nov 2007 at 20:47
[ View Weblogs ]
Great, now the php problem seems to be gone. But the vhosts still gives me some headache. Mind you, I still use the old vhost styles. Let me paste some. This is the /etc/apache2/sites-enabled/000-default (edited for space)
 
NameVirtualHost *


        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/server.tld
        
        
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        


And this is a vhost-container:

        ServerName   vhost.server.tld
        ServerAdmin  ivar@lynweb.net
        DocumentRoot /home/user/webfolder
        IndexOptions FancyIndexing
        ErrorLog /var/log/apache2/error_vhost.log

Now, whever I try to access the vhost I only get the 000-default page. grr!:)

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by simonw (84.45.xx.xx) on Mon 19 Nov 2007 at 21:05
[ View Weblogs ]
My virtual hosts (each in a file in /etc/apache2/sites-available/) all look much like the default one in;

http://www.debian-administration.org/articles/285

Before any webdav is applied.

I have "NameVirtualHost ip.ad.re.ss" in /etc/apache2/apache2.conf just before it includes the available sites I tried a configuration with "NameVirtualHost *" in the other day, but gave up when Apache insisted on moaning about me covering some of the other IP addresses with other hosts (but maybe our config is just too complex for my brain).

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by Anonymous (201.210.xx.xx) on Tue 20 Nov 2007 at 00:15
Yes, it is hard, but after reading some howto's you'll manage to do it. Good luck. See the error logs and google everything.

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by sneex (63.139.xx.xx) on Tue 20 Nov 2007 at 21:15
[ View Weblogs ]
Hey =)

At least it isn't 1994 (it's 2007), this isn't AIX (it's Debian), and you don't have Apache v0.94 (it's v2.2x and built into apt-get repos) to try and compile from scratch with no previous How-Tos available ... :]

But, honestly, I feel your pain -- the best advice is relax and like previously mentioned watch the error logs and Google Google Google.

O'd to the days of gopher ...

-Sx-
http://youve-reached-the.endoftheinternet.org/

[ Parent ]

Re: Apache2 - Is it really that hard?
Posted by Grimnar (85.221.xx.xx) on Tue 20 Nov 2007 at 23:42
[ View Weblogs ]
hehe, thanks for the heads up. Well, this is making me crazy. Several days now with googling and investigations and still don´t see any change. The problems seems to get worse.

[ Parent ]