Hi all,
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?
George
Am 09.08.2013 10:03, schrieb Georgios Petasis:
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?
nothing easier than that, you start httpd with a specific httpd.conf the sample below needs some "LoadModule" in your case because our httpd has statically builtin the used modules since we do not use standard packages for business critical services
but they way to go is easy:
* your own systemd-unit * your own httpd.conf * your own php.ini * if you want different php-extensions your own "php.d" * for make it accesable read from a frontend-server read the mod_proxy manual
PHP_INI_SCAN_DIR=/Volumes/dune/httpd-worker/conf/php.d PHPIniDir "/Volumes/dune/httpd-worker/conf" ______________________________________________________
[root@srv-rhsoft:~]$ cat /etc/systemd/system/httpd-lounge-worker.service [Unit] Description=HTTP-Worker
[Service] Type=simple EnvironmentFile=/Volumes/dune/httpd-worker/conf/systemd-env ExecStart=/usr/sbin/httpd $OPTIONS -D FOREGROUND -f /Volumes/dune/httpd-worker/conf/httpd.conf ExecReload=/usr/bin/kill -HUP $MAINPID Restart=always RestartSec=1 UMask=006 PrivateTmp=yes ReadOnlyDirectories=/etc ReadOnlyDirectories=/usr
[Install] WantedBy=multi-user.target ______________________________________________________
[root@srv-rhsoft:~]$ cat /Volumes/dune/httpd-worker/conf/systemd-env PHP_INI_SCAN_DIR=/Volumes/dune/httpd-worker/conf/php.d OPENSSL_NO_DEFAULT_ZLIB=1 STOP_TIMEOUT=5 LANG=C ______________________________________________________
[root@srv-rhsoft:~]$ cat /Volumes/dune/httpd-worker/conf/httpd.conf ServerName localhost ServerTokens Prod ServerRoot "/etc/httpd" PHPIniDir "/Volumes/dune/httpd-worker/conf" PidFile "/run/httpd/httpd-worker.pid" Timeout 30 KeepAlive Off MaxKeepAliveRequests 50 KeepAliveTimeout 2 User apache Group apache ServerAdmin "hostmaster@thelounge.net" UseCanonicalName Off HostnameLookups Off ServerSignature Off Listen 127.0.0.1:8888 TypesConfig "/etc/mime.types" AccessFileName .htaccess DirectoryIndex index.php EnableSendFile On SendBufferSize 65536 AcceptPathInfo Off TraceEnable Off LimitRequestFields 50 LimitRequestFieldSize 10000 LimitRequestBody 52428800 LimitInternalRecursion 5 FileETag -INode BufferedLogs On RequestReadTimeout "header=5-15,MinRate=500"
StartServers 1 MinSpareServers 1 MaxSpareServers 4 ServerLimit 50 MaxClients 45 ListenBacklog 250 MaxRequestsPerChild 500
LoadModule php5_module "modules/libphp5.so" AddType application/x-httpd-php .php
<Location /> AllowMethods GET HEAD POST </Location>
<Directory /> Options -Indexes -ExecCGI -MultiViews +FollowSymLinks AllowOverride None Require all denied </Directory>
<Directory "/Volumes/dune"> Options -FollowSymLinks </Directory>
ErrorDocument 400 "400: Bad Request" ErrorDocument 403 "403: Access Denied" ErrorDocument 408 "408: Request Timeout" ErrorDocument 500 "500: Internal Server Error" ErrorDocument 501 "501: Not implemented" ErrorDocument 502 "502: Bad Gateway" ErrorDocument 503 "503: Service Unavailable" ErrorDocument 504 "504: Gateway Timeout" ErrorDocument 505 "505: HTTP Version Not Supported" ErrorDocument 404 "404: Not Found" ErrorDocument 405 "405: Method Not Allowed" ErrorDocument 410 "410: Gone" ErrorDocument 411 "411: Length Required" ErrorDocument 412 "412: Precondition Failed" ErrorDocument 413 "413: Request Entity Too Large" ErrorDocument 414 "414: Request-URI Too Long" ErrorDocument 415 "415: Unsupported Media Type"
LogFormat "%a %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined LogLevel notice core:info ErrorLog "/Volumes/dune/httpd-worker/logs/error_log" CustomLog "/Volumes/dune/httpd-worker/logs/access_log" combined
<VirtualHost *> DocumentRoot "/Volumes/dune/httpd-worker/docroot/" <Directory "/Volumes/dune/httpd-worker/docroot"> Require ip 127.0.0.1 </Directory> </VirtualHost>
9.8.2013 11.05 "Georgios Petasis" petasisg@yahoo.gr wrote:
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?
I have not attempted it, but I think it should be possible. You would just write a new systemd unit that'd start Apache so that it would read its configuration files from a different location. Then you could carefully create the alternative configuration so that the Apache instances do not interfere with each other.
- Joonas
Georgios Petasis pise:
Hi all,
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.
Hello,
2013/8/9 Zdenek Pytela pytela@phil.muni.cz:
Yes. You just have multiple Listen lines in your config file and
then you have to restart the httpd.service.
I think the main goal was not just to get Apache to listen to multiple ports, but to have two entirely separate Apache instances running, to prevent a badly behaving web application from affecting the better behaving ones. Of course this would likely also involve having them listen to different ports.
-Joonas
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
Στις 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
On 09.08.2013 10:03, Georgios Petasis wrote:
Hi all,
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?
George
It looks like you're in need of proxy server. I'm doing nginx + apache2 + mod_wsgi for django deployments. Nginx is serving static files and apache2 + mod_wsgi is serving apps. This is really nice and simple solution. It is easy to maintain and when I do "ps" command I know what is what.
Mateusz Marzantowicz