I need to enable additional modules for apache eg, mod_proxy, mod_proxy-html, and mod_proxy_balancer.
Is there a way for me to do that without recompiling the whole apache?
Thanks
You can list the compiled in modules by executing:
$ apache2 -l
Note: this is NOT /etc/init.d/apache2. If the module you need is not already compiled in, you will need to include it inside the configuration file.
See here for a Debian/Ubuntu description.
You need just to copy those modules to some directory on Your system/server,
then add a command for appache in configure file.
ex:
LoadModule mod_proxy modules/mod_proxy.so / linux
LoadModule mod_proxy modules/mod_proxy.dll / windows
http://httpd.apache.org/docs/2.0/mod/mod_so.html#loadmodule
If your apache is built with shared library support, then you could copy these modules from another machine(same OS, same/lower version and preferably same compiler) and place it in modules folder. Then use LoadModule directive to dynamically load it.
If you dont have the modules, you can download the source and build/install apache in a different directory (using --prefix) with option --enable-mods-shared=most. Copy the required modules to the original apache modules folder, and use LoadModule to load it.
Related
I have CentOS 7 and the version of my apache is 2.4.6.
I typed this command:
httpd -l
This is the answer:
Compiled in modules:
core.c
mod_so.c
http_core.c
Therefore, I cannot see the prefork.c among these modules. Also, I cannot see the prefork module in /etc/httpd/conf/httpd.conf
but the answer of the httpd -V | grep "Server MPM" is:
Server MPM: prefork
Moreover, the suggestion of these links is not helpful:
apache2-prefork-dev installation
Prefork MPM configuration not in httpd.conf
((It means that installing httpd-devel was not helpful, and adding following lines in /etc/httpd/conf.modules.d/00-mpm.conf did not fix my problem:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
StartServers 5
ServerLimit 256
MaxRequestWorkers 256
MaxConnectionsPerChild 0
))
I want to see prefork.c in the answer of httpd -l and also I want to see prefork module in /etc/httpd/conf/httpd.conf
what should I do?
Thanks for sharing.
httpd -l only lists the modules that have been added at compile time in the server, as static modules.
Other modules can be loaded dynamically as DSO (Dynamic Shared Object) by calling them with the LoadModule directive in the conf file.
You can list them (along with static ones) using httpd -M instead of httpd -l. If prefork module appears in the list, it's because it is loaded and at work.
Both methods, static and DSO, work well and you can (and probably should) use DSO without any issue.
Regarding the prefork config, it can be inserted directly in httpd.conf, or (as it seems to be your case) in another file, which is then "merged" in the server config with the Include directive in httpd.conf.
You may find the prefork config you search by finding which included file it has been stored into (you should have a /etc/httpd/conf.modules.d/00-mpm.conf but at worst, opening them one by one should eventually give you some result). And if you really want to, you can cut it from there, and paste it directly into httpd.conf instead.
Finally, if you really want to see prefork module appear in static modules list, you will have to manually configure and compile apache sources, adding that specific module as static in the process.
You can read more about this on apache docs, and, should you decide to go that way, you'll probably find that this question is better suited for ServerFault website.
I'm having trouble configuring mod_wsgi with my current set up.
Redhat 2.6.32
Installations setup as non-root user:
Apache 2.2 (attempted to get 2.4, but without access to yum the
dependencies were too much)
Python 3.6
I seem to have successfully installed mod_wsgi into /apache/modules.
Problems:
The apache directory structure is not what most tutorials indicate, its
DocumentRoot is in /apache/htdocs, not /var/www/ or /sites-enabled/ or /sites/available/
I tried putting:LoadModule wsgi_module modules/mod_wsgi.so in httpd.conf but I am returned:
$HOME/apache/modules/mod_wsgi.so into server: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
Can anyone explain how I can use mod_wsgi with my current setup?
The problem is likely because you self compiled mod_wsgi and the Python installation you used is in a non standard location. In this case you need to se LD_RUN_PATH environment variable when running make for mod_wsgi, with it set to the directory the Python library is in. This way knowledge of where the Python library is is embedded in mod_wsgi. This issue is described in the mod_wsgi documentation:
http://modwsgi.readthedocs.io/en/develop/user-guides/installation-issues.html#unable-to-find-python-shared-library
If you can't rebuild mod_wsgi for some reason, you can also force load the Python shared library into Apache by using:
LoadFile /some/path/lib/libpython3.6m.so.1.0
This should be place just before the LoadModule line for mod_wsgi.
Your libpython3.6m.so.1.0 is not in any of apache's library paths.
You can symlink it to one of the lib directories in apache's library path, or you can add the directory where your libpython3.6m.so.1.0 resides to apache's library path.
Check this question out for help with apache paths: https://serverfault.com/questions/151328/setting-apache2-path-environment-variable
My default apache modules are currently within /usr/bin. The modules i have generated however are within /home/user/platform/lib. Within the httpd.conf file i have added the two modules as per example:
LoadModule rtb_module lib/mod_rtb.so
LoadModule win_module lib/mod_win.so
However when loading the modules i see errors because the two mentioned modules reside somewhere else (in this case /home/user/platform/lib). Is there a way to symlink these two modules within the httpd.conf file?
many thanks
using ln -s created a symbolic link to the necessary path, resolving the issue
I am trying to get the GZIP module working in XAMPP window vista 64 bit. I have added the .dll file for gzip into the module directory and added in httpconf. Once I add it say it cannot start apache since it cannot find the ApacheGZIP module in the directory that is mentioned in httpconf file...(which I can see exist in the directory)...
One more thing in the modules directory I found that it has the .so files(i thought it was for unix) so i tried adding the .so gzip and added that to httpconf and tried restarting. Again it complained saying it is not a valid window application...
NEED HELP
THnks
Coool
You can try uncommenting the following in /xampp/apache/conf/httpd.conf:
LoadModule deflate_module modules/mod_deflate.so
You should already have mod_deflate.so enabled if you are using XAMPP. XAMPPLite, however, has that disabled.
On Mac OS X 10.5 I downloaded the latest version of Apache 2.2.9. After the usual configure, make, make install dance I had a build of apache without mod_rewrite. This wasn't statically linked and the module was not built in the /modules folder either.
I had to do the following to build Apache and mod_rewrite:
./configure --prefix=/usr/local/apache2 --enable-rewrite=shared
Is there a way to tell Apache to build all modules as Shared Modules (DSOs) so I can control loading from the Apache config?
Now that I have built Apache and the mod_rewrite DSO, how can I build another shared module without building all of Apache?
(The last time I built Apache (2.2.8) on Solaris, by default it built everything as a shared module.)
Try the ./configure option --enable-mods-shared="all", or --enable-mods-shared="<list of modules>" to compile modules as shared objects. See further details in Apache 2.2 docs
To just compile Apache with the ability to load shared objects (and add modules later), use --enable-so, then consult the documentation on compiling modules seperately in the Apache 2.2. DSO docs.
./configure --prefix=/usr/local/apache2 --enable-mods-shared="all" --enable-proxy=shared
To get rewrite, proxy and bunch of other modules, I used the above command. In my previous installation, using --enable-mods-shared="all" compiled/installed the proxy module as well. But in v2.2.22 "all" did not include the proxy module.