12

I am deploying Flask application in Apache2 server during this i need to run a command for enabling mod_wsgi by using:

sudo a2enmod wsgi

but its showing:

sudo: a2enmod: command not found

please help thanks

F. Hauri - Give Up GitHub
  • 64,122
  • 17
  • 116
  • 137
Shadab Ansari
  • 149
  • 1
  • 2
  • 9
  • 1
    Are you using the system Apache and is it installed? Is the appropriate system ``mod_wsgi`` package installed? – Graham Dumpleton Mar 07 '18 at 08:02
  • For such installation debugging request, please post all details you can: OS (Ok It's Ubuntu), Version ??, Architecture: ??, Harsware ??, Host purpose: Desktop or server? How did you install apache? Etc... (some more observation you could share about your specific case) – F. Hauri - Give Up GitHub Sep 18 '20 at 05:55

4 Answers4

18

I had the same problem with using Ubuntu 16.04 in AWS. However, installing apache2 along with libapache2-mod-wsgi and python-dev solved the issue.

Try:

sudo apt-get update
sudo apt-get install apache2 libapache2-mod-wsgi python-dev

Then,

sudo a2enmod wsgi
midtownguru
  • 2,583
  • 5
  • 22
  • 24
9

I share this tips because it append to me :

If you enter into the root account with su, the /usr/sbin folder is not in the path and the a2enmod command is not found...

So you have to use su - instead ;)

Dharman
  • 30,962
  • 25
  • 85
  • 135
fred727
  • 2,644
  • 1
  • 20
  • 16
5

This can happen if you switch to root user as su root instead of su - on Debian Buster

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
1

Installation debugging

For asking about installation debugging, you have to post (and think) about

  • Architecture (hardware)
  • OS with version
  • Host attibution (server, desktop, other)
  • Procedure followed for installation
  • Software (apache) version

Anyway

You could try to reinstall your package. If under Ubuntu, you could try:

sudo apt update &&
    sudo apt reinstall apache2 libapache2-mod-wsgi

Then rerun:

sudo a2enmod wsgi
F. Hauri - Give Up GitHub
  • 64,122
  • 17
  • 116
  • 137