Hosting separate web2py application and PHP application on same apache fedora server

117 views
Skip to first unread message

sonu kumar

unread,
Apr 16, 2014, 7:02:12 PM4/16/14
to web...@googlegroups.com
I am running one web2py application on fedora webserver. Now I would like to run one PHP application on this same server, but I am not able to configure its httpd.conf file.

At the moment my web2py application setting in httpd.conf file is below in black and red is for my PHP application but not able to access PHP application from web but web2py application running fine:

NameVirtualHost *:80
NameVirtualHost *:443

<VirtualHost *:80>
   ServerName catdb.sanfordburnham.org
   DocumentRoot /data/www/html/catpdb

   <Directory /data/www/html/caspdb>
    AllowOverride None
    Order Allow,Deny
    Deny from all
    DirectoryIndex index.php
  </Directory>

</VirtualHost>


<VirtualHost *:80>
  WSGIDaemonProcess web2py user=apache group=apache processes=1 threads=1
  WSGIProcessGroup web2py
  WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
  WSGIPassAuthorization On

  <Directory /opt/web-apps/web2py>
    AllowOverride None
    Order Allow,Deny
    Deny from all
    <Files wsgihandler.py>
      Allow from all
    </Files>
  </Directory>

  AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) /opt/web-apps/web2py/applications/$1/static/$2

  <Directory /opt/web-apps/web2py/applications/*/static>
    Options -Indexes
    Order Allow,Deny
    Allow from all
  </Directory>

  <Location /admin>
    Deny from all
  </Location>

  <LocationMatch ^/([^/]+)/appadmin>
    Deny from all
  </LocationMatch>

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log
</VirtualHost>

<VirtualHost *:443>
  SSLEngine on
  SSLCertificateFile /etc/httpd/ssl/self_signed.cert
  SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key

  WSGIProcessGroup web2py
  WSGIScriptAlias / /opt/web-apps/web2py/wsgihandler.py
  WSGIPassAuthorization On

  <Directory /opt/web-apps/web2py>
    AllowOverride None
    Order Allow,Deny
    Deny from all
    <Files wsgihandler.py>
      Allow from all
    </Files>
  </Directory>

  AliasMatch ^/([^/]+)/static/(?:_[\d]+.[\d]+.[\d]+/)?(.*) /opt/web-apps/web2py/applications/$1/static/$2

  <Directory /opt/web-apps/web2py/applications/*/static>
    Options -Indexes
    ExpiresActive On
    ExpiresDefault "access plus 1 hour"
    Order Allow,Deny
    Allow from all
  </Directory>

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log
</VirtualHost>

LightDot

unread,
Apr 16, 2014, 8:04:58 PM4/16/14
to web...@googlegroups.com
First thing that jumps at me is the "Deny from all" directive in your PHP vhost... The other things I notice are the typos: you have catdb subdomain, catpdb document root and caspdb directory. At least one of those is a clear typo.

Apache logs are quite helpful with these stuff.

Regards

sonu kumar

unread,
Apr 16, 2014, 8:36:48 PM4/16/14
to web...@googlegroups.com
I just corrected all typos and deleted "Deny from all" and also added

ErrorLog /data/www/html/caspdb/error_log

but still not working as well as nothing is written in error_log file

LightDot

unread,
Apr 16, 2014, 8:45:35 PM4/16/14
to web...@googlegroups.com
So what is the error you get? Apache should either complain at server restart or you should be able to see at least some error description when you attempt to open the page.

Also, I assume you have PHP configured outside of this vhost and enabled server-wide? Are you using mod_fcgid or..?

sonu kumar

unread,
Apr 16, 2014, 8:57:11 PM4/16/14
to web...@googlegroups.com
When I open my catdb application on web it says browser could not find...
there is one php.conf file in /etc/httpd/conf.d/

my php application is totally independent of web2py application...

LightDot

unread,
Apr 16, 2014, 10:09:20 PM4/16/14
to web...@googlegroups.com
Browser could not find... means exactly that. That might not be an apache error at all...

If your domain / subdomain names are correct, than you're missing DNS entries for either caspdb or cleav subdomains. They might work locally if you've put them in /etc/hosts, but they most certainly won't resolve over the internet.

Before worrying about how your PHP is set up, you need to get to the point when your index.php is either executed or you see the text contents...

That being said, this is not really connected with web2py in any way.

sonu kumar

unread,
Apr 17, 2014, 4:22:21 PM4/17/14
to web...@googlegroups.com
Thanks a lot..
now it is working..

Tim Richardson

unread,
Apr 21, 2014, 11:53:28 PM4/21/14
to
I thought it wasn't recommended to run php on a multi-threaded (MPM) apache?
http://www.php.net/manual/en/faq.installation.php#faq.installation.apache2

edit: Ah, based on the mod_wsgi config it looks like you are using pre-fork.

Reply all
Reply to author
Forward
0 new messages