Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the server configurationAction 'configtest' failed - apache

I got the below error while I was configuring CKAN DataPusher.
Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a
module not included in the server configurationAction 'configtest'
failed.
How can I fix this?

Try to enable wsgi mod in Apache
sudo a2enmod wsgi
If you come across below error
ERROR: Module mod-wsgi does not exist!
You will have to install mod wsgi as below. What you have to do is run the following commands,
sudo apt-get install libapache2-mod-wsgi
sudo a2enmod wsgi
sudo service apache2 restart

To enable wsgi_mod in httpd, install the module
sudo yum install mod_wsgi
and make sure to load the module in the httpd config file
sudo nano /etc/httpd/conf/httpd.conf
then add the following line in the config file, to the list of other loaded module:
LoadModule wsgi_module modules/mod_wsgi.so

I had this error after messing up my Apache installation and restarting the setup after an apt purge apache2. This also seems to have removed the wsgi mod but Ubuntu 20 LTS kept thinking it's still around.
So I had to to purge and reinstall the wsgi mod from scratch:
apt purge -y libapache2-mod-wsgi-py3
apt install -y libapache2-mod-wsgi-py3
a2enmod wsgi
After that, Apache was able to find it again.

I faced this problem because
I installed mod_wsgi which was compatible with python3.5, but my project's virtual environment was using python3.7. So, mod_wsgi for 3.7 was required. I installed that as well (python3.7 -m pip install mod_wsgi). But a configuration was missing from apache2 which resulted in this issue.
run : mod_wsgi-express module-config
add the output in /etc/apache2/apache.conf
( LoadModule wsgi_module "/home/user/.local/lib/python3.7/site-packages/mod_wsgi/server/mod_wsgi-py37.cpython-37m-x86_64-linux-gnu.so"
WSGIPythonHome "/usr" )
then restart - sudo service apache2 restart
This solved the problem.

I think you might need to add this line in your apache2.conf
LoadModule wsgi_module "/usr/local/lib/python3.6/dist-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so"
Below command will give you the above output
mod_wsgi-express module-config

Related

Cannot find the pachkage apache2-mpm-worker

getting error on installing mpm-worker in ubuntu apache2.
How to fix this problem?
There is no apache2-mpm-worker package because the mpm_worker module is included by default when you install Apache on Ubuntu's newer versions. It is contained in the apache2-bin package that is a dependency of apache2:
sudo a2dismod prefork event php* && sudo a2enmod worker
If you see any errors like cannot enable module (similar), then let me know with the whole output. Make sure you enable php-fpm when you use prefork, if you wish to use PHP.

Apache config file not being installed

I had apache2 installed on my raspberry pi 4 and was getting some strange behavior so I removed it via apt remove apache2, removed the /etc/apache2 directory and reinstalled by sudo apt-get apache2 -y.
After reinstallation the server would not start, I determine that there was no apache2.conf file in /etc/apache2.
I've tried installing and reinstalling several time to no avail. What am I doing wrong?
try
sudo apt-get purge apache2
If you just want a light-weight http server you might want to try Nginx as a replacement.
sudo apt-get --reinstall install apache2

a2enmod command not found in apache server using cpanel in linux vps

after going to /etc/httpd/conf/httpd.conf and even after changing
Allow override none -> Allow override All , and then restarting the server using
service httpd restart
and then i type the command
a2enmod proxy
then i get an error :
bash- a2enmod command not found. .
Can you please help me? i am getting an error in the developer tools console when i am using web-sockets and so for that i need to enable web-sockets proxy.
I had the same problem, and this answer solved my issue:
Apache2 command such as a2enmod and a2ensite no working its showing command not found in Ubuntu
Try:
sudo apt-get update
sudo apt-get install apache2 libapache2-mod-wsgi
Then,
sudo a2enmod wsgi
Then, you might also want to try sudo a2enmod instead of just a2enmod
On Debian a2enmod is located at /usr/sbin/a2enmod and sometimes /usr/sbin is not in your PATH.

Apache: Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration

When configure apache2 virtual hosts for ssl/https connection, after adding configuration and enable the configuration with this command " a2ensite pm.university.com.conf " i got this error "Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration". I will answer my own question.
It turned out I did enabled ssl module but i had to do it again and it works, here is the command:
sudo a2enmod ssl
Now restart apache like so service apache2 restart
no more error, FIXED!
sudo a2enmod ssl
and restart the apache service that will do the trick
Invalid command 'SSLEngine', perhaps misspelled or defined by a module not included in the server configuration
Simply:
This error likely happens on apache if your "virtual host" is trying to use SSL but you did not install SSL module on your apache.
Case 1: For Centos (linux distro), run:
yum install mod_ssl openssh
Case 2: For Ubuntu or Debian (linux distros), run:
sudo a2enmod ssl
And it should install and configure everything (a new file *-ssl.conf should appear in your conf.modules.d folder)
sudo yum install mod_ssl
sudo a2enmod ssl
sudo apachectl restart
When you edit the site configuration file, you have to test the configuration before enabling the site just to ensure its Syntax is correct. Use the command below to test the configuration.
apache2ctl configtest
or
sudo apache2ctl configtest
So if the syntax is correct you get a response similar to the one below
If you get the SSLEngine: Invalid command error then run the following command and go back to step one, solve all Syntax errors until it says Syntax OK.
sudo a2enmod ssl
Restart apache using the following command
sudo apachectl restart
Hopefully that solves the error.
Try following Solution:
Open the file httpd.conf at "your apache folder"/conf
Find the following line using CTRL+f in your text editor: #LoadModule ssl_module modules/mod_ssl.so
Remove the #(uncomment the line)
Save and restart your apache

Installing Cobbler on Ubuntu 15.10 seems to break apache, how can I fix this?

I am trying to install Cobbler on a brand new Ubuntu 15.10 virtual box but it is not working. When I run the apt-get install cobbler cobbler-web it seems to break apache completely to the point I can't get it working again.
I see this in the apache error log:
[wsgi:crit] [pid 8112:tid 140273573488512] mod_wsgi (pid=8112): The mod_python module can not be used on conjunction with mod_wsgi 4.0+. Remove the mod_python module from the Apache configuration.
and this in the auth.log:
polkitd(authority=local): Unregistered Authentication Agent for unix-process:8081:54865 (system bus name :1.24, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
I have tried removing the mod_python and wsgi modules but apache still doesn't start up. And I think Cobbler uses them anyways, so I kind of need them.
I have also tried disabling polkitd. I don't find any clues when searching for that weird error message.
I was able to install Cobbler on Ubuntu 14.04 pretty easily and apache works fine.
Here is the basic chain of install commands I used:
apt-get update
apt-get install apache2
apt-get install isc-dhcp-server
apt-get install bind9 bind9utils bind9-doc
apt-get install cobbler cobbler-web debmirror mkisofs
Disable the module by typing sudo a2dismod python
You should then see this:
Module python disabled. To activate the new configuration, you need to
run: service apache2 restart
So type sudo service apache2 restart.
If that doesn't fix it, check the error log for more information by typing
cat /var/log/apache2/error.log.