LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 01-05-2004, 04:32 PM   #1
asktoby
Member
 
Registered: Jul 2003
Location: Cardiff, England ;)
Distribution: Mandrake 9.1
Posts: 94

Rep: Reputation: 15
Talking I got apache going!


Hi,

This post details the steps I went through to get apache working on my Mandrake 9.1 box. There's a few queries along the way but it's mainly to help other people.

Installed Mandy 9.1 (didn't choose apache as part of the install)
Downloaded the apache source
compiled the source using:
$ ./configure --prefix=/usr/local/apache2
$ make
$ make install
$ /usr/local/apache2/bin/apachectl start

The final line gave the error:
"httpd: Could not determine the server's fully qualified domain name, using..."

so I edited /usr/local/apache2/conf/httpd.conf, finding the line:
#ServerName www.example.com:80
and uncommented it, changing it to:
ServerName xx.xxx.xx.xxx:80 (IP munged for security)

This is the static IP of my router, witch is set to forward external TCP (not UDP) requests on port 80 to the static local network IP of my linux machine. I hope I did this correctly - I'm not 100% sure!

Then, running
apachectl start
gave the error:

[error] (13)Permission denied: could not open transfer log file /usr/local/apache2/logs/access_log.
Unable to open logs

I then su'd into root, and ran:
./apachectl start
from within /usr/local/apache2/bin

No errors, and
ps ax | grep apac
shows:
16824 ? S 0:00 /usr/local/apache2/bin/httpd -k start

So it seems to be running, but is it safe to run apache as root?

If I then go to my web browser, and type
http://xx.xxx.xx.xxx (IP munged for security)
into the address bar it thinks for a while and returns:

An error occured while loading http://xx.xxx.xx.xxx: (IP munged for security)
Timeout on server
Connection was to xx.xxx.xx.xxx at port 80 (IP munged for security)

So I am unsure what to do next... then Brainwave! I went into Mandrake Control Centre and added 80/TCP under the advanced settings of my firewall. Success! Going to http://xx.xxx.xx.xxx (IP munged for security) now brings up the Apache test page. I am so happy, I am so happy!

Now I'd like to have apache run automatically when I boot my computer. I got an email app called "korn" to load automatically on boot by adding a link (right-click, create new, link to application) to it in:
file:/home/toby/.kde/Autostart

I can't do the same for apache since it needs root privelages. Any advice?

Last edited by asktoby; 01-06-2004 at 02:04 AM.
 
Old 01-05-2004, 05:07 PM   #2
Dewar
Member
 
Registered: Sep 2003
Location: Washington State
Distribution: SuSE 8.0, SuSE 9.0, Slack 9.1
Posts: 90

Rep: Reputation: 15
It is not at all safe to run apache as root.

The log problems you are having might be caused by a simple permissions problem. Check the /usr/local/apache2/logs/access_log file permissions. Is the owner the same user as apache should be (usualy nobody but there are a few others)

Finally, if worse comes to worse, give full 766 permissions to that log file. It's better than running apache as root at least.

-Dewar
 
Old 01-06-2004, 02:11 AM   #3
asktoby
Member
 
Registered: Jul 2003
Location: Cardiff, England ;)
Distribution: Mandrake 9.1
Posts: 94

Original Poster
Rep: Reputation: 15
Damn, I'm away from my computer all day now - I hope no-one finds the box before this evening...

So if, when I get home, I go:

cdcd usr/local/apache2/logs
chown nobody access_log

I should be able to run apache as a user, rather than root?
 
Old 01-06-2004, 09:27 AM   #4
hypexr
Member
 
Registered: Oct 2003
Location: USA Fresno Callifornia
Distribution: Gentoo (workstation), ArchLinux (file/mail server), Freebsd (web server), Ubuntu (laptop)
Posts: 115

Rep: Reputation: 16
Muhaha, I've already discovered what xx.xxx.xx.xxx really is and am well on my way to massive damage. Just Joking! Anywayz,

Running the initial instance of apache as root is almost always regarded as okay. The child processes should come up, however, as a different user. Like nobody, ect... Running as root is necessary to access privileged ports (port 80). You can run it as a user and not use a privileged port (port 8080, ect...). If doing this then the child processes are locked into being the same user, which is not always a good thing.
 
Old 01-06-2004, 10:06 AM   #5
Dewar
Member
 
Registered: Sep 2003
Location: Washington State
Distribution: SuSE 8.0, SuSE 9.0, Slack 9.1
Posts: 90

Rep: Reputation: 15
Hmm, That's different than what I heard, but it does make a lot of sense. *shrug* I guess you learn something everyday. Sorry about my alarming message then.

-Dewar
 
Old 01-07-2004, 05:12 AM   #6
asktoby
Member
 
Registered: Jul 2003
Location: Cardiff, England ;)
Distribution: Mandrake 9.1
Posts: 94

Original Poster
Rep: Reputation: 15
So, it is safer to run apache as root than as a user...

If I want to run apache automatically at startup I would probably try by adding some lines to .profile or .bash_profile

However, I guess that would run apache as the currently logged in user. How should I go about running it, at startup, as root? I can't imagine it would be possible without storing my root password somewhere which is surely a security risk?

Or maybe I'm barking up the wrong tree, in the wrong forest... I've never edited .profile or .bash_profile so I'm very naïve.
 
Old 01-07-2004, 05:56 PM   #7
hypexr
Member
 
Registered: Oct 2003
Location: USA Fresno Callifornia
Distribution: Gentoo (workstation), ArchLinux (file/mail server), Freebsd (web server), Ubuntu (laptop)
Posts: 115

Rep: Reputation: 16
I've never used Mandrake so I don't know about their run level scripts, but on some distributions you can create a script that will run the /usr/local/apache2/bin/apachectl start command. Then you can make it executable and put it in your /etc/rc.d or /etc/init.d or wherever your initiation scripts go. This will now be executed automatically on boot or it you will need to add it to one of your configuration files. Or if Mandrake has software to control this stuff, then use it.
Don't put it in your .profile or anything like that.
 
  


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
Mail from Apache being rejected - Cannot route to sender apache@localhost.localdomain jimwillsher Linux - Networking 2 01-19-2006 12:41 AM
Apache 1.3.33 (debian built) and Apache SSL does not respond to the proper ports lqorg_user Linux - Networking 0 11-06-2005 04:11 PM
Strange apache trailing / problem - Slack-current, apache 1.3.33 vamp Linux - Networking 1 01-30-2005 07:28 PM
Apache Webserver 403 Forbidden Errors (User not in apache group?) Mankind75 Mandriva 4 07-08-2004 05:30 AM
apache benchmarks (apache v13 / apache v20) ; large differences between benchmarking markus1982 Linux - Software 0 02-08-2003 10:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva

All times are GMT -5. The time now is 06:31 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