You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Aruna Gummalla <ar...@yahoo.com> on 2010/02/22 20:09:10 UTC

[users@httpd] Can I have 2 httpd servers running on 2 different ports?

Hi,

Can I have 2 httpd servers running on 2 different ports? If so, what is the configuration change that i need to do.

I tried running apachectl start with different port numbers in httpd.conf. But it says httpd already running.

Please let me know. Thanks in advance.

Thanks & Regards,
Aruna.



      

Re: [users@httpd] Re: Can I have 2 httpd servers running on 2 different ports?

Posted by Sheryl <gu...@his.com>.
> When a developers needs an apache instance to play with, they would
> typically just do something like this:
> '/usr/local/sbin/httpd -f /home/foo/proj/conf/httpd.conf'. The only
> things they need in conf are the httpd.conf, mime.types and magic.
> Typically, they'll declare a server root in the conf file, with a logs
> folder below server root. That's pretty muc hall that is needed.

Developer playgrounds are something else, and they run them as they please
on their workstations.  I was describing what we do for shared servers
with dev/qa/production workflow stacks.  Per security policy, nobody is
allowed to run a site out of their home directory (or even have a login on
QA or production), and we don't have any of the stack software in
/usr/local even on sites which haven't been merged into an
/opt/site/sitename stack so they can easily be copied from machine to
machine.

As with anything else, YMMV with your environment.  I probably would
consider your setup a little crazy with the kind of superficial exposure
we get here, starting with running httpd out of /usr/local (assuming
you'll ever want to compile a second version for any reason).

> However, we don't do this so much anymore. Now typically, we will
> configure a separate freebsd jail for each service.

I'd like to be doing something like that, or VMs, but unfortunately those
methods have not been so easy to get approved.

Sheryl


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Can I have 2 httpd servers running on 2 different ports?

Posted by Tom Evans <te...@googlemail.com>.
On Thu, Feb 25, 2010 at 7:00 PM, Sheryl <gu...@his.com> wrote:
>
>>> What benefit does this give you over running VirtualHost?
>>>
>>
>> (I wouldn't set up a second instance like suggested, but..)
>
> Curious about why not...
>
> BTW, my example was a little simplified.  In practice we actually make a
> link "base" which points to the apache directory and the link bin to
> base/bin, etc.  That way, when we compile a new version we put it in its
> own directory and change the link.  Easy to upgrade, easy to back off if
> it doesn't work.
>

Because it isn't needed. If you don't need to change compile time
options, all apache needs to run is a different config file, not a
replication of the /usr/local/ hierarchy.

In fact, we use freebsd, and install apache from ports, using the
supplied rc script to manage 'profiles', which define the separate
instances of apache to run, with all necessary configuration in
/usr/local/etc/apache22-{profile-name}. No crazy symlinks required!

When a developers needs an apache instance to play with, they would
typically just do something like this:
'/usr/local/sbin/httpd -f /home/foo/proj/conf/httpd.conf'. The only
things they need in conf are the httpd.conf, mime.types and magic.
Typically, they'll declare a server root in the conf file, with a logs
folder below server root. That's pretty muc hall that is needed.

However, we don't do this so much anymore. Now typically, we will
configure a separate freebsd jail for each service.

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Can I have 2 httpd servers running on 2 different ports?

Posted by Sheryl <gu...@his.com>.
>> What benefit does this give you over running VirtualHost?
>>
>
> (I wouldn't set up a second instance like suggested, but..)

Curious about why not...

BTW, my example was a little simplified.  In practice we actually make a
link "base" which points to the apache directory and the link bin to
base/bin, etc.  That way, when we compile a new version we put it in its
own directory and change the link.  Easy to upgrade, easy to back off if
it doesn't work.

More recently we have been moving toward multiple compiles because we're
trying to put everything in its own stack in preparation for moving to
VMs. But we still do the linking in order to make upgrades easier.

> 1) You can load different modules in different instances
> 2) Separation of concerns
> 3) Different global configuration options
> 4) Different compile time options

All of those apply, but most of it has to do with what I assume you mean
by (2).  We have several different customer groups and many applications.
Although we do run VirtualHost, each instance of apache belongs to one
organizational entity.  That way, two groups with different missions don't
have to agree on a restart for changing a paramter (and for that matter
don't have to agree to the change, which relates to (3) above).  Also,
easier to co-ordinate software upgrades.

> For instance, on our reverse proxies, we run two instances of apache,
> one handles SSL and runs prefork MPM, and one handles regular HTTP and
> runs the event MPM.
>
> Cheers
>
> Tom
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Re: Can I have 2 httpd servers running on 2 different ports?

Posted by Tom Evans <te...@googlemail.com>.
On Thu, Feb 25, 2010 at 2:00 PM, LuKreme <kr...@kreme.com> wrote:
> On 24-Feb-10 10:49, Sheryl wrote:
>>
>> Instead, just have a different directory for each instance.  For instance
>>
>> /usr/local/apache -- where you install your software
>>
>> /opt/server1 -- first server
>>     bin, build, error, icons, include, lib, man, manual, modules,
>> mime-types, magic are links to equivalent in /usr/local/apache
>>     cgi-bin, conf, htdocs, logs are directories; conf should be a copy of
>> /usr/local/apache/conf
>
> What benefit does this give you over running VirtualHost?
>

(I wouldn't set up a second instance like suggested, but..)

1) You can load different modules in different instances
2) Separation of concerns
3) Different global configuration options
4) Different compile time options

For instance, on our reverse proxies, we run two instances of apache,
one handles SSL and runs prefork MPM, and one handles regular HTTP and
runs the event MPM.

Cheers

Tom

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


[users@httpd] Re: Can I have 2 httpd servers running on 2 different ports?

Posted by LuKreme <kr...@kreme.com>.
On 24-Feb-10 10:49, Sheryl wrote:
> Instead, just have a different directory for each instance.  For instance
>
> /usr/local/apache -- where you install your software
>
> /opt/server1 -- first server
>      bin, build, error, icons, include, lib, man, manual, modules,
> mime-types, magic are links to equivalent in /usr/local/apache
>      cgi-bin, conf, htdocs, logs are directories; conf should be a copy of
> /usr/local/apache/conf

What benefit does this give you over running VirtualHost?

-- 
NO. I CANNOT BE BIDDEN. I CANNOT BE FORCED. I WILL DO ONLY THAT WHICH I 
KNOW TO BE RIGHT. --Mort

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can I have 2 httpd servers running on 2 different ports?

Posted by Sheryl <gu...@his.com>.
bob wrote:

> Just give the servers different names. apache2 and
> apache2-different_port. Means you have to compile each server with that
> name and your server with the not 80 address will have a different
> Listen port in the httpd.conf file.

Compiling individually is not necessary.  We run dozens of servers off one
compile.

Instead, just have a different directory for each instance.  For instance

/usr/local/apache -- where you install your software

/opt/server1 -- first server
    bin, build, error, icons, include, lib, man, manual, modules,
mime-types, magic are links to equivalent in /usr/local/apache
    cgi-bin, conf, htdocs, logs are directories; conf should be a copy of
/usr/local/apache/conf

/opt/server2 -- set up the same way

Edit /opt/servername/conf/httpd.conf and replace all occurrences of
/usr/local/apache with /opt/servername/apache

Then when you start up use -d /opt/servername/apache -f
/opt/servername/apache/conf in addition to any other flags you'd pass
apachectl.

Sheryl


> Start the server with
> /usr/local/apache2-different_port/bin/apachectl start. The nice thing
> about doing this is that you can put different things in different
> servers - say a light server with not much added and then a server with
> php and mod-perl to do other things.
>
> bob
>
> Aruna Gummalla wrote:
>> Hi,
>>
>> Can I have 2 httpd servers running on 2 different ports? If so, what
>> is the configuration change that i need to do.
>>
>> I tried running apachectl start with different port numbers in
>> httpd.conf. But it says httpd already running.
>>
>> Please let me know. Thanks in advance.
>>
>> Thanks & Regards,
>> Aruna.
>>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can I have 2 httpd servers running on 2 different ports?

Posted by Robert Van Horn <rv...@abcreek.wisequackranch.com>.
Just give the servers different names. apache2 and 
apache2-different_port. Means you have to compile each server with that 
name and your server with the not 80 address will have a different 
Listen port in the httpd.conf file. Start the server with 
/usr/local/apache2-different_port/bin/apachectl start. The nice thing 
about doing this is that you can put different things in different 
servers - say a light server with not much added and then a server with 
php and mod-perl to do other things.

bob

Aruna Gummalla wrote:
> Hi,
>
> Can I have 2 httpd servers running on 2 different ports? If so, what 
> is the configuration change that i need to do.
>
> I tried running apachectl start with different port numbers in 
> httpd.conf. But it says httpd already running.
>
> Please let me know. Thanks in advance.
>
> Thanks & Regards,
> Aruna.
>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can I have 2 httpd servers running on 2 different ports?

Posted by Paul McFerrin <pm...@columbus.rr.com>.
Did you miss out on the <VirtualHost *> file??  With this, you only need 
one server to serve all of those hosts.  They all will have same port 
numbers and you don't have to play with the PID file.  I've been serving 
multiple hosts for years.

- Paul

Tommy M. McGuire wrote:
> Yes, you can[1]; you'll need to use different port numbers (or limit them to
> different IP addresses) and there is a PID file (or lock file, I cannot
> remember at the moment) that has to be different. The only changes you need
> are in the configuration and startup scripts.
>
> [1] We have an OpenSSO policy agent in one server and a separate server for
> the stuff that actually has to work.
>
> Aruna Gummalla wrote:
>   
>> Hi,
>>
>> Can I have 2 httpd servers running on 2 different ports? If so, what is
>> the configuration change that i need to do.
>>
>> I tried running apachectl start with different port numbers in
>> httpd.conf. But it says httpd already running.
>>
>> Please let me know. Thanks in advance.
>>
>> Thanks & Regards,
>> Aruna.
>>
>>     
>
>
>   
> ------------------------------------------------------------------------
>
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com 
> Version: 9.0.733 / Virus Database: 271.1.1/2707 - Release Date: 02/24/10 02:34:00
>
>   


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can I have 2 httpd servers running on 2 different ports?

Posted by "Tommy M. McGuire" <mc...@crsr.net>.
Yes, you can[1]; you'll need to use different port numbers (or limit them to
different IP addresses) and there is a PID file (or lock file, I cannot
remember at the moment) that has to be different. The only changes you need
are in the configuration and startup scripts.

[1] We have an OpenSSO policy agent in one server and a separate server for
the stuff that actually has to work.

Aruna Gummalla wrote:
> Hi,
> 
> Can I have 2 httpd servers running on 2 different ports? If so, what is
> the configuration change that i need to do.
> 
> I tried running apachectl start with different port numbers in
> httpd.conf. But it says httpd already running.
> 
> Please let me know. Thanks in advance.
> 
> Thanks & Regards,
> Aruna.
> 


-- 
Tommy M. McGuire
mcguire@crsr.net

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can I have 2 httpd servers running on 2 different ports?

Posted by John Hudak <jj...@gmail.com>.
What is the  reason that you want two instances of the server running on two
different ports?  Perhaps using virtual servers will resolve your issue?

John


On Mon, Feb 22, 2010 at 2:09 PM, Aruna Gummalla <ar...@yahoo.com>wrote:

> Hi,
>
> Can I have 2 httpd servers running on 2 different ports? If so, what is the
> configuration change that i need to do.
>
> I tried running apachectl start with different port numbers in httpd.conf.
> But it says httpd already running.
>
> Please let me know. Thanks in advance.
>
> Thanks & Regards,
> Aruna.
>
>

Re: [users@httpd] Can I have 2 httpd servers running on 2 different ports?

Posted by Scott Gifford <sg...@suspectclass.com>.
On Mon, Feb 22, 2010 at 2:09 PM, Aruna Gummalla <ar...@yahoo.com>wrote:

> Hi,
>
> Can I have 2 httpd servers running on 2 different ports?
>

Sure.  You'll want to create a new configuration file and start Apache using
that configuration file.  You can run Apache by hand, or you can copy
apache2ctl and change the settings in there, then run your copy.

That's a bit vague, I know, but I hope it will get you started.  You may
find there's an easier answer if you don't really need two Apache servers,
but can get by with one of the other suggestions from this thread.

-----Scott.

Re: [users@httpd] Can I have 2 httpd servers running on 2 different ports?

Posted by Da...@YMP.GOV.
Do you really need two different web servers?  You can use 1 web server to 
listen on two different ports.  Just duplicate the sections with the ports 
numbers in the one configuration file.

If in fact you really do want two different web servers, you will need two 
completely different configuration files.  Add '-f <filename>' to your 
apachectl command to point at each configuration file.

Dan



Please respond to users@httpd.apache.org

To:     users@httpd.apache.org
cc:      (bcc: Dan Mitton/YD/RWDOE)
Subject:        [users@httpd] Can I have 2 httpd servers running on 2 
different ports?
LSN: Not Relevant
User Filed as: Not a Record

Hi,

Can I have 2 httpd servers running on 2 different ports? If so, what is 
the configuration change that i need to do.

I tried running apachectl start with different port numbers in httpd.conf. 
But it says httpd already running.

Please let me know. Thanks in advance.

Thanks & Regards,
Aruna.