Directing wsgi to the correct python - wsgi

I'm trying to run a django app with wsgi on apache on acentos6.5.
Centos6.5 comes with python2.6 while I need python2.7 so I've installed it and want to use my virtualenv.
Since apache was complaining that it does not find django, I decided to set the python home but then it complains that it cannot even the os package.
Here is my httpd.conf:
WSGIPythonHome /root/venv/bin
WSGISocketPrefix /var/run/wsgi
<VirtualHost *:80>
ServerName myproj.com
Serveralias www. myproj.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/ myproj
ErrorLog /var/log/httpd/ myproj_error.log
CustomLog /var/log/httpd/ myproj_access.log combined
WSGIDaemonProcess myproj python-path=/var/www/ myproj:/root/venv/lib/python2.7/site-packages:/root/venv/lib/python2.7:/root/venv/lib/python2.7/site-packages/
WSGIProcessGroup myproj
WSGIScriptAlias / /var/www/ myproj/ myproj/wsgi.py
<Directory /var/www/ myproj/>
AllowOverride All
Allow from all
</Directory>
<Directory /root/venv/lib/python2.7/site-packages/>
AllowOverride All
Allow from all
</Directory>
</VirtualHost>
here is the path of my virtualenv:
/root/venv/bin/python2.7
Can someone guide me how to make wsgi find and use my python2.7?
Note: I easily made it work on ubuntu so there must be a trick to centos.
Note: I'm sure that it's using python2.6 because I put a log statement in wsgi.py.

Related

Installing MantisBT on WSL2

I have installed MantisBT in Ubuntu in wsl2, I had no problem following the instructions like in another ubuntu server (unless for enabling ufw), but at the moment of open the browser to proceed with the installation I just see the contents of the file index.php.
index.php in Browser
I'd try to search information about installing mantisBT in wsl without success, so that is why I come here to ask if anyone had successfully installed MantisBT in Ubuntu in Wsl or you have any clues to try to resolve this.
This is my apache confid file,
<VirtualHost *:80>
ServerAdmin webmaster#yourdomain.com
DocumentRoot "/var/www/html/mantis"
ServerName localhost
ServerAlias localhost
ErrorLog "/var/log/apache2/mantis-error_log"
CustomLog "/var/log/apache2/mantis-access_log" combined
<Directory "/var/www/html/mantis/">
DirectoryIndex index.php index.html
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
It was due to a missing php package, so first make sure you have all the packages require, I found this thanks to the mantis-error_log file, In my case was php-fpm. but just installing it does not do the trick, yo have to install it, start the service and restart apache2
sudo apt install php7.x-fpm
sudo service php7.x-fpm start
sudo service apache2 restart
One thing I may have forgot also, was to change the permissions of the mantis folder
sudo chmod -R 755 /var/www/html/mantis
and finally I made some changes in th conf file and system32/drivers/host
to make it work at its own URL. This was just improvemnt, not really part of th problem.
<VirtualHost *:80>
ServerAdmin webmaster#yourdomain.com
DocumentRoot "/var/www/html/mantis"
ServerName mantis.test
ServerAlias www.mantis.test
ErrorLog "/var/log/apache2/mantis-error_log"
CustomLog "/var/log/apache2/mantis-access_log" combined
<Directory "/var/www/html/mantis/">
DirectoryIndex index.php index.html
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
system32/drivers/etc/hosts
127.0.0.1 mantis.test
::1 mantis.test

wsgi cant find modules in virtualenv in weblate + apache2 + wsgi setup

I got the weblate running in dev mode with :8000. But I am not able to get it running in apache2 with wsgi within the virtual environment, where everything worked.
Based on apache errors, it could not even find django installed.
I did that but saw another error of a missing module.
Its clear that wsgi is not respecting/searching for modules in the virtualenv for python.
My server is Ubuntu 19.04.
Please suggest.
<VirtualHost *:80>
ServerName xxyyzz.com
# DATA_DIR/static/favicon.ico
Alias /favicon.ico xxyyzz/weblate-env/lib/python3.7/site-packages/data/static/favicon.ico
# DATA_DIR/static/
Alias /static/ xxyyzz/weblate-env/lib/python3.7/site-packages/data/static/
<Directory xxyyzz/weblate-env/lib/python3.7/site-packages/data/static/>
Require all granted
</Directory>
# DATA_DIR/media/
Alias /media/ xxyyzz/weblate-env/lib/python3.7/site-packages/data/media/
<Directory /home/weblate/data/media/>
Require all granted
</Directory>
# Path to your Weblate virtualenv
WSGIDaemonProcess weblate python-path=xxyyzz/weblate-env
WSGIProcessGroup weblate
WSGIApplicationGroup weblate
WSGIScriptAlias / xxyyzz/weblate-env/lib/python3.7/site-packages/weblate/wsgi.py process-group=weblate
WSGIPassAuthorization On
<Directory xxyyzz/weblate-env/lib/python3.7/site-packages/weblate/>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
Same as: https://docs.weblate.org/en/latest/admin/install.html
It turns out that the example configuration is wrong, it should be using python-path instead of python-home for WSGIDaemonProcess. I've just fixed this in Weblate and you will probably need such change in your configuration as well.

Python3 & WSGI Module error

<VirtualHost *:80>
ServerName superhost.gr
ServerAdmin nikos#superhost.gr
WSGIDaemonProcess public_html user=nikos group=nikos processes=1 threads=5
WSGIScriptAlias / /home/nikos/public_html/webapp.py
ProxyPass / http://superhost.gr:5000/
ProxyPassReverse / http://superhost:5000/
<Directory /home/nikos/public_html>
WSGIProcessGroup public_html
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
AddHandler wsgi-script .wsgi .py
Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch +ExecCGI
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
Any ideas as to why iam getting the above error although i have python36 isntalled along with all modules? why can it find it?
Most likely because your mod_wsgi isn't compiled for Python 3.6, or you have installed modules in a virtual environment but haven't told mod_wsgi where that virtual environment is.
For the first issue do the check in:
http://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html#python-installation-in-use
Note you can't force mod_wsgi compiled for one Python version to use another Python versions' installation or virtual environment.
For the second, see:
http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html

Apache VirtualHost Setup on QNAP for Sub Sirectories

I am trying to setup vHost on my QNAP web server (Running Apache). I seem to be stuck at the point where I can't load the subdomains. I have included a custom conf file in the apache.conf file like so:
include /share/Web/customapache.conf
In the customapache file, I have the following:
NameVirtualHost *:80
ServerName 127.0.0.1
DocumentRoot "/share/Web/site1-home"
<Directory />
Order deny,allow
Deny from all
</Directory>
ServerSignature Off
ServerTokens Prod
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
# ServerAlias www.localhost
DocumentRoot "/share/Web/site1-home"
<Directory "/share/Web/site1-home">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName pods.localhost
# ServerAlias www.pods.localhost
DocumentRoot "/share/Web/site2-pods"
<Directory "/share/Web/site2-pods">
Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
It's probably a bit of a mess as I have been trying multiple different examples trying to fix whatever issues I have. I am fairly new to linux, and apache to be honest. I was able to get it all working fine in NGINX, however I ran into some compatability issues with QNAP.
Essentially, the main redirect is working, so that the base directory is now /share/Web/site1-home, but the subdomain is not working (pods.localhost). I am sure its something simple I am missing, or even something I have added that I do not need. But any assistance, or even a point in the right direction would be much appreciated.
Regards
Kirt

VirtualHost apache 2.2

some months ago I had apache 2.4 and I could create virtualhost, but now I had to change my apache version to 2.2 and my virtualhost is not working, I also have linux mint 17
my virtualhost file is the next: zendvirtual.conf
<VirtualHost *:80>
ServerAdmin roberth#zend
ServerName zend
ServerAlias zend
DocumentRoot /var/www/frameworks/zend/public
<Directory /var/www/frameworks/zend/public>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Someone knows if I have to add something more, a new line, another configuration?
The syntax:
Require all granted
is not supported under Apache 2.2. The equivalent is:
Allow from all

Resources