Operating System - Linux
1826387 Members
4364 Online
109692 Solutions
New Discussion

How to start Apache server by define user

 
elkok
Occasional Contributor

How to start Apache server by define user

Hi guys,

I have modified the httpd.conf contain for user & group as: user webuser, group webuser.

I have also chown -R webuser for the whole apache directory and files.
Still, when I login as webuser and type:apachectl start, the apache will come out error message like:make_socke error... for 127.0.0.1 ...

The only way to start up web server is I login as root and start up the webserver. Of course the PID 1 for apache server belong to root. Then the child process for apache server are belong the user 'webuser'. How do i start up httpd server by user instead of 'ROOT' ?

Your advice is appreciate

People In & out of your life but only fews leave foot print in your heart
4 REPLIES 4
Jerome Henry
Honored Contributor

Re: How to start Apache server by define user

Hi,

Apache needs to be started first with root rights. It's necessary for it to achieve peoxesses privileges, and then su to your webuser.

Once this su is done, the initial process uid 0 is killed, so there is no root apache running when the daemon is running.

The message you get indicates that : httpd tries to create an initial socket, which only root can create : webuser can't and process stops...

hth

J
You can lean only on what resists you...
Paulo A G Fessel
Trusted Contributor

Re: How to start Apache server by define user

Look up these two directives in your httpd.conf - depending on your distribution, they may be sitting on other files than httpd.conf which are included by httpd.conf:

User
Group

Change them to the user/group (webuser/?) you have chowned the apache directory and them restart apache.

It's not neccessary to log on as the "Apache user", as it's been already said.

HTH
Paulo Fessel
L'employé propose, le boss dispose.
Oliver Charni
Trusted Contributor

Re: How to start Apache server by define user

hello!

On what Port does the Apache run ? If it's the default on 80 then it has to run as root. If you want to run completely as Webuser you have to put it on a Port +1024.
if it smell's funny on the outside, it's worse on the inside
Jerome Henry
Honored Contributor

Re: How to start Apache server by define user

Yes,

But don't forget that a first launch, Apache starts at uid 0 to set up all connection opening, then this process called 'father process' makes up children, which are the real apache processes, opened under apache user or webuser, whatever you want to call it... It's clear that apache user is well know, and using another one can sound a good idea. But remember that webuser is the 'alternative example' used in most apache tuts... so maybe choosing another one would be a better idea...

:]] paranoid, I know, but better paranoid than hacked down...

J
You can lean only on what resists you...