Re: Can I run two "instances" of apache httpd?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Στις 9/8/2013 18:31, ο/η Reindl Harald έγραψε:

Am 09.08.2013 16:12, schrieb Zdenek Pytela:
Georgios Petasis pise:
In my apache configuration, I am using a scripting language (tcl
through apache rivet) which implements a "heavy" application,
something that takes some minutes to start when apache starts a new
process.

Is there a way to "separate" these "heavy" apache processes from the
rest of the apache?

I.e. when the url is "/my_heavy_service" redirect the request to the
apache which has the "heavy" application loaded, and the rest of the
requests be handled by an apache with does not even has mod_rivet
loaded?

Like starting an apache on a different port (i.e. 8123), which loads
my application, and starting a "normal" apache on port 80, which
serves all requests except some, which are directed to the server in
port 8123.

In general I think it can be done (i.e.:
http://wiki.apache.org/httpd/RunningMultipleApacheInstances),
but is a way to do this in fedora 19, and keep all this "systemctl *
httpd" stuff?

Has anyone attempted this?
Yes. You just have multiple Listen lines in your config file and
then you have to restart the httpd.service
and how does this magically have a own, isolated httpd-instance
without "mod_rivet" whcih was the question

well i posted a answer with complete examples short
after the question but with this idiotic moderation
it is worthless

I think I have received your answer. After a few hours of looking into this, I have automated it (for my case) in the following bash script:

# Steps to create a second running instance of httpd...

# 1) Create the needed script for systemctrl...
/usr/bin/cp -f /usr/lib/systemd/system/httpd.service \
      /usr/lib/systemd/system/httpd-palo.service
sed -i "s/EnvironmentFile=\/etc\/sysconfig\/httpd/EnvironmentFile=\/etc\/sysconfig\/httpd-palo/g" /usr/lib/systemd/system/httpd-palo.service


# 2) Prepare the environment file...
/usr/bin/cp -f /etc/sysconfig/httpd /etc/sysconfig/httpd-palo

# 3) Append our options...
echo "OPTIONS= -DPaloServices -f conf/httpd-palo.conf" >> /etc/sysconfig/httpd-palo

# 4) Copy http.conf...
/usr/bin/cp -f /etc/httpd/conf/httpd.conf /etc/httpd/conf/httpd-palo.conf
sed -i "s/Listen 80/PidFile \/run\/httpd-palo\/httpd.pid\\nListen 81/g" /etc/httpd/conf/httpd-palo.conf sed -i 's/logs\/error_log/logs\/palo_error_log/g' /etc/httpd/conf/httpd-palo.conf
sed -i 's/conf\.d/palo_conf.d/g' /etc/httpd/conf/httpd-palo.conf

# 5) Create palo_conf.d...
mkdir -p /run/httpd-palo
rm -rf /etc/httpd/palo_conf.d
mkdir -p /etc/httpd/palo_conf.d
ln -s /etc/httpd/conf.d/my_palo.conf /etc/httpd/palo_conf.d/my_palo.conf
ln -s /etc/httpd/conf.d/my_rivet.conf /etc/httpd/palo_conf.d/my_rivet.conf
#ln -s /etc/httpd/conf.d/ssl.conf /etc/httpd/palo_conf.d/ssl.conf
chcon -R -u system_u -r object_r -t httpd_config_t /etc/httpd/palo_conf.d /etc/httpd/conf.d

systemctl --system daemon-reload

systemctl enable  httpd-palo.service
systemctl enable  httpd.service
systemctl restart httpd-palo.service
systemctl restart httpd.service

What it actually does is to copy everything from the httpd configuration, into a new one, named httpd-palo. Which runs in port 81, and has its own config directory, in /etc/httpd/palo_conf.d. There, I create symbolic links from conf files in /etc/httpd/conf.d.

One of the configuration files is "special" (my_palo.conf), as it has two branches, according to whether the name "PaloServices" is defined:

<IfDefine PaloServices>
Alias /palo/appservices  /home/palo/opinionBuster/webapps_services
Alias /palo/app          /home/palo/opinionBuster/webapps
Alias /palo              /home/palo/opinionBuster/services
....
</ifDefine>

<IfDefine !PaloServices>
LoadModule proxy_module      modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
ProxyRequests Off
SSLProxyEngine on
ProxyPass        /palo http://localhost:81/palo
ProxyPassReverse /palo http://localhost:81/palo
</IfDefine>

I am ok with my solution, I now have two independent httpd server instances :-)

George
--
users mailing list
users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org




[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux