Django deployment with mod_wsgi on wamp 3.0.6 - mod-wsgi

I followed mod-wsgi document and installed mod-wsgi using pip install command .It had been installed successfully.
I followed the command as suggested mod_wsgi-express module-config mod_wsgi-express start-server does not work in windows
and got the output:
Output :
LoadFile "c:/users/user/python36.dll"
LoadModule wsgi_module "c:/users/user/lib/site-packages/mod_wsgi/server/mod_wsgi
.cp36-win_amd64.pyd"
WSGIPythonHome "c:/users/user"
Now I am not able to find how does it work with wamp as some one has suggested that mod_wsgi.so needs to be copied in apache folder to get it functional .
Wamp Version:3.0.6
Apache :2.4.23
Python : 3.6.
Thanks in Advance
Post Changes in httpd.conf:
<Directory ${INSTALL_DIR}/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
<VirtualHost *:80>
ServerName www.example.com
ServerAlias example.com
ServerAdmin webmaster#example.com
DocumentRoot ${INSTALL_DIR}/www
<Directory ${INSTALL_DIR}/www>
Order allow,deny
Allow from all
</Directory>
LoadModule wsgi_module "c:/users/user/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIScriptAlias /myapp {$INSTALL_DIR}/www/wsgi-scripts/myapp.wsgi
<Directory ${INSTALL_DIR}/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

You need to copy the output from running mod_wsgi-express module-config and add it to the Apache configuration file. Then restart Apache to make sure it restarts okay.
Once that works, then configure Apache for your specific WSGI application, although better to start with a hello world WSGI application.
http://modwsgi.readthedocs.io/en/develop/user-guides/configuration-guidelines.html

Related

Apache - Run site under sub directory (?)

I'm sure it's been answered, but I'm failing to find the right search terms to find the solution.
I have a site (mysite.com) running in Apache, this is working great:
<VirtualHost mysite.com:80>
ServerName www.mysite.com
ServerAlias *.mysite.com
DocumentRoot /var/www/mysite
</VirtualHost>
I would like to run this site one level up in the url, something like this: mysite.com/past/2019
I can't get this to work by modifying the ServerName or ServerAlias values.
For this firstly you have to enable the apache2 rewrite module. You can enable this by running the command 'sudo a2enmod rewrite' after this add below line to your apache2 vhost
<Directory /var/www/mysite>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Then restart your apache2 server by running command sudo service apache2 restart
Hope it works for you.

Cannot deploy the application with capistrano & passenger to Centos

I have Centos 7. I've installed Passenger & Apache. After deploying the application to the server with Capistrano. I get the error:
Could not find rake-12.0.0 in any of the sources (Bundler::GemNotFound)
I've set owner group of working folder to apache (and nobody). But it is nothing.
My apache configuration:
<VirtualHost *:80>
ServerName ...
# Be sure to point to 'public'!
DocumentRoot /home/kanna/www/bb/current/public
<Directory /home/kanna/www/bb/current/public>
# Relax Apache security settings
AllowOverride all
Require all granted
# MultiViews must be turned off
Options -MultiViews
SetEnv GEM_HOME /home/kanna/www/bb/shared/bundle/ruby/2.3.0/gems
</Directory>
</VirtualHost>
Thanks.
I added line into Directory:
PassengerRuby /home/kanna/.rvm/gems/ruby-2.3.3/wrappers/ruby
If you want to see debug information you can add the line:
PassengerFriendlyErrorPages on

Apache Virtual Host not working

I recently upgraded to the latest version of PHP (before this everything was working) and had the following virtual host configuration file under /etc/apache2/sites-enabled/local.events
<VirtualHost *:80>
ServerName events.local
DocumentRoot "/home/john/development"
<Directory "/home/john/development">
AllowOverride All
</Directory>
</VirtualHost>
However instead of running my website located under /home/john/development when I go to http://local.event/ it runs the file located at /var/www/index.html. How do I fix this and also why is this the case after I only updated PHP using the following code:
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update
sudo apt-get upgrade
Change
<VirtualHost *:80>
ServerName events.local
ServerAleas events.local
DocumentRoot "/home/john/development"
<Directory "/home/john/development">
AllowOverride All
</Directory>
</VirtualHost>
2. Need add in /etc/hosts line (127.0.0.1 events.local)

Run Python under Apache already running PHP using mod_wsgi

I am running PHP at the server using apache web-server.
My website is running nice.
Now i need to run python on my web-server without affecting PHP in anyway.
I used the following link to configure mod_wsgi in httpd.conf under apche after installing mode_wsgi.
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide
The configuration I updated is as follows:
<VirtualHost *:80>
ServerName www.quipmate.com
ServerAlias quipmate.com
ServerAdmin webmaster#quipmate.com
DocumentRoot /usr/local/www/documents
Alias /robots.txt /usr/local/www/documents/robots.txt
Alias /favicon.ico /usr/local/www/documents/favicon.ico
Alias /media/ /usr/local/www/documents/media/
<Directory /usr/local/www/documents>
Order allow,deny
Allow from all
</Directory>
WSGIDaemonProcess quipmate.com processes=2 threads=15 display-name=%{GROUP}
WSGIProcessGroup quipmate.com
WSGIScriptAlias / /usr/local/www/wsgi-scripts/myapp.wsgi
<Directory /usr/local/www/wsgi-scripts>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
After updating and restarting apache, I got 404 error on my index.php file in my web document root. Also it did not helped me any way with the python script which was outputed directly on the browser. Please help.
WHich is exactly what one would expect as you used WSGIScriptAlias to mount the WSGI application at the root of the web site, thus hiding everything else on the web site.
You may want to use the AddHandler and mod_rewrite solution described in the end of the section:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive
This will allow PHP files to take precedence and only fall through to the WSGI application if the request is not satisified.

Need help setting up passenger with apache

I'm trying to setup passenger with apache on Fedora 14. The install went ok but I'm unable to configure apache correctly.
I made these changes to the file. I cannot start apache unless I comment out the virtual host portion.
LoadModule passenger_module
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.7/ext/apache2/mod_passenger.so
PassengerRoot
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.7
PassengerRuby /usr/bin/ruby
<VirtualHost *:80>
ServerName localhost
DocumentRoot /home/antarr/pull/public
<Directory /home/antarr/pull/public>
AllowOverride all
Options -MultiViews
</Directory>
</VirtualHost>
You also need the following two lines in your apache2.conf or in a conditionally loaded, module specific conf file:
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.7
PassengerRuby /usr/local/bin/ruby
Instead of modifying httpd-vhosts.conf override DocumentRoot in your httpd.conf
# Override default DocumentRoot with you root
DocumentRoot "/home/antarr/pull/public"
<Directory "/home/antarr/pull/public">
Allow from all
Options -MultiViews
Require all granted
</Directory>
Before restarting server make sure your conf change is reflected
apachectl -S
The Document root should point to your root folder. And restart apache.