SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 2 copies of Apache on the same server

    First of all, apologies for posting this here, I realize this is a PHP forum, not an Apache forum, but there are a lot of very Apache-savvy people here, so here it is:

    Has anyone had experience running 2 copies of Apache on the same server?

    The reason I need to do this is I have a Linux box we use for hosting for our regular clients. But we also have an app that requires the user that Apache runs as to be able to become SU and do some maintenance tasks. The only way I have figured out how to access config files on the box is by having the Apache user have the ability to become SU. This of course is a HUGE security problem that's why I think the solution is to run 2 copies of Apache, one with a different user and only the admins have access to that copy.

    Does anyone know of a better way? How does Webmin do it for example?

    Thanks all.
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're right. This goes in Configuring Your Server, and the answer is yes you can run 2 Apache instances but they have to be on different ports.

    Aaron
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Sketch
    answer is yes you can run 2 Apache instances but they have to be on different ports.
    Aaron, can you provide me some specifics on how to do this or send me a link to more info?

    For example, would I have to compile apache again? I guess the PID files would be ok since each is specified in the httpd.conf file.
    Last edited by pata; Feb 24, 2004 at 16:10.
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  4. #4
    Apache Expert i_like_php's Avatar
    Join Date
    Nov 2001
    Location
    Dallas, Texas
    Posts
    1,342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    one server will have to have port 80 and the other port can have 8080.
    i love php

  5. #5
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If anyone is interested, this is what I ended up doing:

    1. Compiled Apache again in a different folder (/usr/sec/apache)
    2. Set it to listen to port 2082 only
    3. Secured all access to the default htdocs folder with htpasswd.
    4. set the min and max children of Apache quite low
    5. set the user to run this version of apache as one who can sudo.
    6. set the httpd.conf file so that both servers share the same php library and .ini file.

    It works beautifully since everthing is separate, including the apachetl script. And they share php so no fiddling about with 2 php versions.
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  6. #6
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    pata,
    why not use the same daemon but then run two instances of it.
    Each instance will refer to a different httpd.conf
    In fact you can launch the httpd daemon by specifying the path of the httpd.conf

    I think it would be more easy for you to mantain then.
    About the apachectl script I have a few experience with it, though.




    p.s.
    Many thanks for your feedback!!!
    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  7. #7
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmmm, hadn't thought of that. So I can have the same daemon running under 2 different users, with 2 different httpd.conf files? How do I do that?

    Simply by running httpd -f alternate_httpd.conf?

    But why do you think it would be easier to maintain?
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com

  8. #8
    FreeBSD The Power to Serve silver trophy pippo's Avatar
    Join Date
    Jul 2001
    Location
    Italy
    Posts
    4,514
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    > Simply by running httpd -f alternate_httpd.conf?
    Yes.

    > But why do you think it would be easier to maintain?
    Because you have to maintain only one Apache binary,
    so when you have to upgrade apache it's an easy job
    You need only to mantain two copies of httpd.conf, by the way it is possible, afaik, to include some files within httpd.conf.
    so for example you can write a file called common.httpd.conf and then you can include it from httpd1.conf and from httpd2.conf

    I never did it but ages ago I read it was possible...
    and it seems me too


    Mr Andrea
    Former Hosting Team Advisor
    Former Advisor of '03

  9. #9
    SitePoint Evangelist
    Join Date
    May 2002
    Location
    Barcelona, Spain
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I see. The only thing is I really like using apachectl. And I don't think it would work for 2 daemons with different conf files since the path to the conf file (and other values) is hardwired in apachectl. I guess I could always rewrite a second apachectl file with the right values.

    What I really like about it is the configtest, which I guess I can just use httpd -t

    hmmm...
    Used to prefer PHP.
    Now I prefer Maya but stuck with PHP
    bruji.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •