Error While trying to setup mod wsgi in windows apache - apache

I installed mod_wsgi module in apache by copying it into the modules directory and then changing the httpd.conf file accordingly by adding LoadModule wsgi_module modules/mod_wsgi.so.
The directory block that I included is as follows:
WSGIScriptAlias /wsgi “C:/Django-1.5.1/wsgi/wsgi_handler.py”
<Directory “C:/Django-1.5.1/wsgi”>
AllowOverride None
Options None
Order deny,allow
Allow from all
</Directory>
However on starting apache I get the following error:
Syntax error on line 243 of C:/xampp/apache/conf/httpd.conf:
<Directory "\xe2\x80\x9cC:/Django-1.5.1/wsgi\xe2\x80\x9d"> path is invalid.
I do not understand why that garbage is being appended to the path.
What am I doing wrong here?

You likely are mixing 32 bit and 64 bit versions of Apache. Python and mod_wsgi. You must use all 32 bit or all 64 bit. Use binaries from:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi
Using the distribution of Apache they used to build mod_wsgi.

Related

Why is my ProxyPass and uWSGI not connecting?

I am trying to get a python environment live for a Django project and it's fighting me. I have installed mod_proxy_uwsgi through EasyApache4 (mod_proxy was already on). I have added the following include in the Apache include editor under pre-virtual host (Versioned):
include /etc/apache2/conf.d/userdata/std/2_4/user/domain/proxy.conf
with the following content:
ProxyPreserveHost On
ProxyPass "/" "unix://localhost/var/run/swerth_django.sock"
ProxyPassReverse "/" "unix://localhost/var/run/swerth_django.sock"
I have used YUM installer to install uWSGI and run using a .ini file (command:uwsgi --ini php.ini) with the following content which is executing fine so far (no error messages):
[uwsgi]
chdir=/home/swerth/public_html/mysite
module=mysite.wsgi:application
env=DJANGO_SETTINGS_MODULE=mysite.settings
master=True
pidfile=/tmp/project-master.pid
socket=127.0.0.1:49152
processes=5
harakiri=20
post-buffering=1
max-requests=5000
vacuum=True
home=/home/swerth/public_html/Swerth.VirtualEnv
Despite all this, it's still not working. My Django project still isn't serving. I have a sneaky suspicion that there's something I don't understand about these systems and reverse proxying. Is there something I'm missing or messing up?
Ok, so turns out I was adding my Include function under the versioned part of the includes editor and it needed to be added under the global one because of how the includes editor adds the files to the main httpd.conf file (versioned wasn't being included into the main httpd.conf for some reason)

Loading a module to Apache

I am currently trying to load a module to Apache, build using cmake. The module is called mod_mapcache. It is built successfully and installed correctly in /usr/lib/apache2/modules directroy.
I am using Ubuntu. So I created a new file called mapcache in /etc/apache2/conf.d folder. And wrote
LoadModule mapcache_module modules/mod_mapcache.so
<IfModule mapcache_module>
<Directory /usr/lib/apache2/modules>
Order Allow,Deny
Allow from all
</Directory>
MapCacheAlias /mapcache "/home/mwh/mapcache/mapcache.xml"
</IfModule>
But when I restart the server error generates telling the file is not there. What am I doing wrong in here?
apache2: Syntax error on line 234 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/conf.d/mapcache: Cannot load /etc/apache2/modules/mod_mapcache.so into server: /etc/apache2/modules/mod_mapcache.so: cannot open shared object file: No such file or directory
Action 'graceful' failed.
It is built successfully and installed correctly in /usr/lib/apache2/modules directroy.
and
Cannot load /etc/apache2/modules/mod_mapcache.so into server: /etc/apache2/modules/mod_mapcache.so: cannot open shared object file: No such file or directory
The module isn't installed where the Apache expects it as per configuration.
So you might like to change the module's configuration to be:
LoadModule mapcache_module /usr/lib/apache2/modules/mod_mapcache.so

Apache .htaccess - DATA_PATH causes error

I have a .htaccess with the following code:
SetEnv BASE_URL http://localhost:86/extranet/
SetEnv LOG_PATH C:\wamp\www\extranet\logs\
SetEnv SERVER_ROOT C:\wamp\www\
SetEnv SITE_ROOT C:\wamp\www\extranet\
SetEnv DATA_PATH C:\wamp\www\extranet\data\
The DATA_PATH causes this error in Apache
SetEnv takes 1-2 arguments, an environment variable name and optional value to pass to CGI., referer: http://localhost:86/
Please help. Thanks
The problem turned out to be more complex than previously thought. First because it was on Windows I used backslashes but this was wrong. Also I had <IfModule mod_#Rewrite.c> in the file as well. This was causing some conflicts so I removed those tags. The Rewrite still works without those tags.

apache ssi include with file abc.inc fails (abc.html, abc.txt, abc.xxx, abc.INC works fine)

apache 2.2.15, +Includes in directory container and XBitHack Full
somefile.html has line <!-- #include file="abc.inc" -->
This include fails with "unable to include "abc.inc" in log
If I change the extension of the file (and the include statement) to virtually anything (e.g. abc.xxx, abc.txt, abc.html, even abc.Inc or abc.INC) everything works fine. ONLY abc.inc fails
I've looked for definitions of inc in mime.types, grep'ed everything in the httpd conf files/directories.
Not a huge problem but it's got me curious.
thanks

Configure EasyPHP to use CGI

I'm trying to modify my EasyPHP to run in CGI mode.
According to this link: http://www.easyvitools.com/phpserial/php_ser_reference.html
I have to add in this line:
LoadModule php5_module "C:/Program Files/EasyPHP 2.0b1/php5/php5apache2.dll" to httpd.conf
However, everytime I do that, EasyPHP gives me this error:
Error in Apache configuration file:
""apache.exe: syntax error on line 126
of ..../apache/conf/httpd.conf. API
module structure 'php5_module' in the
file C:..../php5/php5apache2.dll is
garbled - perhaps this is not an
APache module DSO?""
I've checked that the file php5apache2.dll exists and that it is correct in the config file. Does anybody know what could cause this problem or am I doing something wrong to change it to CGI mode instead of using the default APache handler?
I believe that you may need to re-read the instructions:
Comment this line:
#LoadModule php5_module "c:/Php/php5apache2.dll"
And add 2 new lines:
ScriptAlias /php/ "c:/php/"
Action application/x-httpd-php "/php/php-cgi.exe"
So it appears that the line you are adding actually needs to be commented out / removed. And you need to use these alternative directives in httpd.conf.

Categories