Can I run two "instances" of apache httpd?
Reindl Harald
h.reindl at thelounge.net
Fri Aug 9 08:18:30 UTC 2013
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 at 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 at 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 at 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 at 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>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://lists.fedoraproject.org/pipermail/users/attachments/20130809/977c1fa0/attachment.sig>
More information about the users
mailing list