How do I fix "invalid command 'WSGIScriptAlias'" error when running mod_wsgi with Apache - windows

I am trying to run a Django project through Apache with Mod_wsgi on Windows. I installed Apache as a service and installed mod_wsgi to my Python, and then copied it over to my Apache modules. I added the configuration details that the mod_wsgi documentation talks about, but when I try to run Apache it triggers:
"Mod_Wsgi Error: "invalid Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the server configuration...."
mod_wsgi downloaded to Apache modules
Apache httpd.conf:
Define SRVROOT "C:\Users\(me)\Desktop\httpd-2.4.51-win64-
VS16\Apache24"
ServerRoot "C:\Users\(me)\Desktop\httpd-2.4.51-win64
VS16\Apache24"
WSGIScriptAlias /C:/Users/(me)/Desktop/coding_stuff/django_webpage_project/django_webpage_project/wsg
i.py
WSGIPythonHome C:/Users/(me)/Desktop/coding_stuff/env/venv_1
WSGIPythonPath C:/Users/(me)/Desktop/coding_stuff/django_webpage_project
<Directory/C:/Users/(me)/Desktop/coding_stuff/django_webpage_project/django_webpage_project>
<Files wsgi.py>
Require all granted
</Files>
</Directory>

Issue was that the Mod_wsgi files I downloaded were missing the 'modules.so' shared object file that Apache needs to run Mod_wsgi. Still don't know where to acquire this file, but that is certainly the issue.

Related

mod_was_ap22_http.so is not available on Websphere 9?

I'm trying to integrate IBM Http Server to WAS on windows server. Webspher, IHS, Plugins, all installed on same server by installation manager, all of them are version 9 and 64bit.
Then I follow the steps on this(https://geekflare.com/integrate-http-server-with-websphere-8-5/) to start my integration, but something when wrong: I cannot find mod_was_ap22_http.so in my plugin folder. I when to check the folder X:\IBM\WebSphere\Plugins\bin\64bits and D:\IBM\WebSphere\Plugins\bin\32bits, I see mod_was_ap24_http.dll and mod_was_ap22_http.dll but not the .so that I need. I also tried to use mod_was_ap24_http.dll in my httpd.conf file but it's not working, then I got the following error
The IBMHTTPServer9 service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.
httpd: Syntax error on line 116 of X:/IBM/HTTPServer/conf/httpd.conf: Cannot loa
d X:/IBM/WebSphere/Plugins/bin/64bits/mod_was_ap24_http.dll into server: %1 \xa4
\xa3\xacO\xa6\xb3\xae\xc4\xaa\xba Win32 \xc0\xb3\xa5\xce\xb5{\xa6\xa1\xa1C
Is there something that I'm not doing right?
The guide is written for Linux and you're on Windows. Further, the guide has typos in configuration files. I'd suggest following the official docs and running PCT/WCT instead of manually configuring all of this.
Just add mentioned module:
[root#172 bin]# locate mod_was_ap22_http.so
Go to location:
/opt/IBM/HTTPServer/conf
vim http.conf
(add mentioned below module)
LoadModule was_ap22_module /opt/IBM/WebSphere/Plugins/bin/64bits/mod_was_ap22_http.so
./apachectl -k start

How to install mod_jk (Apache Tomcat Connectors) on Windows Server?

I'm a new technical. My problem is, I have the web application that running on tomcat7. now i want to install and configure mod_jk on windows server to connect apache and tomcat.
Please tell me, how to do that?
Thanks
First of all you must download the correct mod_jk connector binaries depending on your apache httpd version from here:
http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/
If your apache is a 2.2 version, choose this:
http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/tomcat-connectors-1.2.40-windows-i386-httpd-2.2.x.zip
If it is a 2.4, choose one of them depending if you prefer 64 or 32 bit version:
http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/tomcat-connectors-1.2.40-windows-i386-httpd-2.4.x.zip
http://archive.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/windows/tomcat-connectors-1.2.40-windows-x86_64-httpd-2.4.x.zip
Download and unzip correct one. Then, extract mod_jk.so from the zip and place it in your apache httpd modules folder, typically [APACHE_HOME]/modules
Once done it, you must create a workers.properties file, typically in apache conf directory or any other inside it (conf.d, extra, etc).
Usually workers.properties file has following content:
worker.list=worker1,jkstatus
#Set properties for worker19 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.ping_timeout=1000
worker.worker1.connect_timeout=10000
worker.worker1.prepost_timeout=10000
worker.worker1.socket_timeout=10
worker.worker1.connection_pool_timeout=60
worker.worker1.connection_pool_size=90
worker.worker1.retries=2
worker.worker1.reply_timeout=300000
# status worker
worker.jkstatus.type=status
You must check that worker.worker1.host and worker.worker1.port have correct values to reach your tomcat's ajp connector. 8009 port is the commonly used, but better check that in your tomcat's server.xml and set the correct one in workers.properties.
Then, in httpd.conf or any other external conf file, add the following:
# Load mod_jk module
LoadModule jk_module modules/tomcat-connector/mod_jk.so
# Add the module (activate this lne for Apache 1.3)
# AddModule mod_jk.c
# Where to find workers.properties
JkWorkersFile conf/extra/workers.properties # Check the path is correct to your workers.properties
# Where to put jk shared memory
JkShmFile logs/mod_jk.shm
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
Once done this, you could try restarting Apache httpd to see if everything already done is correct. If apache starts correctly, now you can start planning how you would redirect matching requests from httpd to tomcat. The easiest way is to redirect every request which matches the context path of your Tomcat webapp.
If your application listens in http://localhost:8080/app-context/ then you could simply add this in httpd.conf or the file where you set the load_module sentences, just after JKLogLevel:
JkMount /app-context/* worker1
Note here that worker1 must match the name you gave to the worker in workers.properties file.
Now, just restart apache httpd, make sure that Tomcat is running and then try in a browser next url:
http://localhost/app-context/
And if you reach your Tomcat webapp, everything is done.

How do I upgrade Apache Tomcat from 6.0.20 to 6.0.24?

Our security team has scanned our production server and identified vulnerabilities with Apache Tomcat server v 6.0.20.
They have recommended that Apache be upgraded to 6.0.24. Reading through the forums, I believe this is the process to do so
Take a backup of httpd.conf file
Using add remove programs, uninstall version 6.0.20
Install 6.0.24
But, I have some questions depending on a quick test I did to install 6.0.20 and upgrade it to 6.0.24
Where do I get Tomcat administrator login information?
Is it enough just to backup the HTTPD.CONF file? I was thinking to back up everything in the Apache folder instead.
Is it possible not to upgrade 6.0.20 to 6.0.24 by running the MSI installer over the same Apache folder? Is it due to the HTTP/1.1 Connector Port being busy/used that doesn't allow an update of Tomcat on the same port?
Is a restart of the server required after upgrade?
Last but not the least, I am using these executables to test the upgrade. 6.0.20 gets installed fine but when I run 6.0.24, it prompts me for the JRE path and directing it to 6.0.20 JVM Path gives me a message that "JVM is not found". The JVM info on the Apache manager is in this directory
What am I missing here?
I need your thoughts and advice to make this as easy as possible since this is a production server.

How to set up mod_proxy_wstunnel on Apache 2.2 on CentOS

Is there a way to set up the mod_proxy_wstunnel module on Apache 2.2 on CentOS? I can't upgrade to 2.4 due to project limitations.
I have invested lot of time figuring this out and there is very little documentation available for this. Let me know if this helps, else I can help you troubleshooting the problem. Also hope this helps to future readers.
To compile mod_proxy_wstunnel.so,
yum install httpd-devel
Download the mod_proxy_wstunnel.c
Compile it using, apxs -i -a -c mod_proxy_wstunnel.c
Now load the above compiled module in /etc/httpd/modules
Copy the mod_proxy_wstunnel.so in /etc/httpd/modules (Compiled from above)
In order to load the module while the server starts, use LoadModule directive in the httpd conf file, /etc/httpd/conf/httpd.conf
Add the following line with all other LoadModule line,
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
To restart apache, use service httpd restart
To check the loaded modules in apache after restarting use, httpd -M
After the module is installed, Add this two lines in /etc/httpd/conf/httpd.conf
ProxyPass /websockets/mywebsocket ws://mywebsocketserver.com//websockets/mywebsocket retry=4
ProxyPassReverse /websockets/mywebsocket ws://mywebsocketserver.com//websockets/mywebsocket retry=4
Note: Make sure the above lines are added before the default case of /. Also restart apache just to be safe.

load mod_wsgi failed on apache 2.2

All,
I want add mod_wsgi modules to my local apache 2.2 server. But when I add "LoadModule module_wsgi modules/mod_wsgi.so" into https.conf file. the apache service will be unable to started. follow error is added to error.log file.
httpd.exe: Syntax error on line 129 of C:/Apache2.2/conf/httpd.conf: Can't locate API module structure `module_wsgi' in file C:/Apache2.2/modules/mod_wsgi.so: No error
For additional information, folloing is my computer's settings.
My computer is run Windows 7 system.
I had install xampp 1.8.1 (It has built in apache 2.4 service). And I install apache 2.2 with a standalone setup package. and binding it to port 8888. If I don't add wsgi module. it work normal. So, my computer has two apache service instances.
I had install python 2.6.6 in my system and add c:\Python26 in my system path.

Resources