apache2 - Use bottlepy and php in the same computer -
i use ubuntu 12.04 apache2 , mod_wsgi installed. i want use bottlepy , php in local computer. know such issue asked else in apache mod_wsgi , php in same domain. suggest me make new question since problem different.
i've change /etc/apache2/sites-available/default
this:
<virtualhost *:80> serveradmin webmaster@localhost documentroot /var/www <directory /> options followsymlinks allowoverride none </directory> <directory /var/www/> options indexes followsymlinks multiviews allowoverride none order allow,deny allow </directory> scriptalias /cgi-bin/ /usr/lib/cgi-bin/ <directory "/usr/lib/cgi-bin"> allowoverride none options +execcgi -multiviews +symlinksifownermatch order allow,deny allow </directory> errorlog ${apache_log_dir}/error.log # possible values include: debug, info, notice, warn, error, crit, # alert, emerg. loglevel warn customlog ${apache_log_dir}/access.log combined alias /doc/ "/usr/share/doc/" <directory "/usr/share/doc/"> options indexes multiviews followsymlinks allowoverride none order deny,allow deny allow 127.0.0.0/255.0.0.0 ::1/128 </directory> </virtualhost> <virtualhost *> documentroot /home/gofrendi/workspace/kokoropy servername oraiso wsgidaemonprocess kokoropy user=www-data group=www-data processes=1 threads=5 wsgiscriptalias /kokoropy /home/gofrendi/workspace/kokoropy/kokoro.wsgi <directory /home/gofrendi/workspace/kokoropy> wsgiprocessgroup kokoropy wsgiapplicationgroup %{global} order deny,allow allow </directory> </virtualhost>
the first virtual host php, , second 1 bottlepy. put bottlepy application in /home/gofrendi/workspace/kokoropy
. , have kokoro.wsgi
in same directory contains script:
import os sys.path = [os.path.dirname(__file__)] + sys.path kokoropy import kokoro_init pwd = os.path.dirname(os.path.abspath(__file__)) app_directory = 'applications' application_path = os.path.join(pwd, app_directory) application = kokoro_init(application_path = application_path, run = false)
i've enable configuration using
sudo a2ensite default sudo service apache2 restart
my php scripts still work expected. but, whenever don't know how access bottlepy script.
i've try remove php part of /etc/apache2/sites-available/default
, consists of
<virtualhost *> documentroot /home/gofrendi/workspace/kokoropy servername oraiso wsgidaemonprocess kokoropy user=www-data group=www-data processes=1 threads=5 wsgiscriptalias /kokoropy /home/gofrendi/workspace/kokoropy/kokoro.wsgi <directory /home/gofrendi/workspace/kokoropy> wsgiprocessgroup kokoropy wsgiapplicationgroup %{global} order deny,allow allow </directory> </virtualhost>
but still can't bottlepy work. show 404 not found.
do has same experience? how make work? thanks.
the problem has been solved. first change httpd.conf setting (or in case /etc/apache2/sites-available/default
) nto this:
<virtualhost *:80> serveradmin webmaster@localhost servername localhost documentroot /var/www <directory /> options followsymlinks allowoverride none </directory> <directory /var/www/> options indexes followsymlinks multiviews allowoverride none order allow,deny allow </directory> scriptalias /cgi-bin/ /usr/lib/cgi-bin/ <directory "/usr/lib/cgi-bin"> allowoverride none options +execcgi -multiviews +symlinksifownermatch order allow,deny allow </directory> errorlog ${apache_log_dir}/error.log # possible values include: debug, info, notice, warn, error, crit, # alert, emerg. loglevel warn customlog ${apache_log_dir}/access.log combined alias /doc/ "/usr/share/doc/" <directory "/usr/share/doc/"> options indexes multiviews followsymlinks allowoverride none order deny,allow deny allow 127.0.0.0/255.0.0.0 ::1/128 </directory> # start edit it: # tells apache wsgi existance wsgidaemonprocess kokoropy user=www-data group=www-data processes=1 threads=5 wsgiscriptalias /kokoropy /home/gofrendi/workspace/kokoropy/kokoro.wsgi <directory /home/gofrendi/workspace/kokoropy> wsgiprocessgroup kokoropy wsgiapplicationgroup %{global} options execcgi order deny,allow allow </directory> </virtualhost>
this configuration localhost/kokoropy
should handled wsgi.
my wsgi script located @ /home/gofrendi/workspace/kokoropy/kokoro.wsgi
. kokoro.wsgi content follow:
import os, sys os.chdir(os.path.dirname(__file__)) sys.path = [os.path.dirname(__file__)] + sys.path bottle import default_app @route('/') def index(): return 'run apache' application = default_app()
if found internal sever error, when accessing bottlepy, find no error when accessing php, mistake in wsgi. open apache log (in case here: /var/log/apache2/error.log
)
Comments
Post a Comment