3 wsgi apps, but only the '/' is loading

11 views
Skip to first unread message

Νίκος Βέργος

unread,
Sep 7, 2018, 12:48:39 PM9/7/18
to modwsgi
i have this mod_wsgi configuration but onlly web.py runs normally my other 2 separate wsgi apps give a NOT found when they are tried to run through the browser.

    <Directory /home/nikos/public_html>
        AllowOverride None
        Require all granted
    </Directory>
    
    WSGIDaemonProcess downloads user=nikos group=nikos threads=5 home=/home/nikos/public_html
    WSGIScriptAlias /downloads /home/nikos/public_html/downloads.py process-group=downloads application-group=%{GLOBAL}
    
    WSGIDaemonProcess clientele user=nikos group=nikos threads=5 home=/home/nikos/public_html
    WSGIScriptAlias /clientele /home/nikos/public_html/clientele.py process-group=clientele application-group=%{GLOBAL}
    
    WSGIDaemonProcess app user=nikos group=nikos threads=5 home=/home/nikos/public_html
    WSGIScriptAlias / /home/nikos/public_html/app.py process-group=app application-group=%{GLOBAL}

for example if i try:

    Not Found
    The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

Νίκος Βέργος

unread,
Sep 7, 2018, 2:04:25 PM9/7/18
to modwsgi
I even tried this setup within httpd-vhosts.conf to see if my other 2 wsgi scripts would work being run by their own seperate domains.

    <VirtualHost *:80>
        ServerName clientele.superhost.gr
        ServerAdmin ni...@superhost.gr
    
        <Directory /home/nikos/public_html>
            Require all granted
        </Directory>
    
        WSGIDaemonProcess clientele user=nikos group=nikos home=/home/nikos/public_html/
        WSGIScriptAlias / /home/nikos/public_html/clientele.py process-group=clientele application-group=%{GLOBAL}
    </VirtualHost>
    
    
    
    
    <VirtualHost *:80>
        ServerName downloads.superhost.gr
        ServerAdmin ni...@superhost.gr
    
        <Directory /home/nikos/public_html>
            Require all granted
        </Directory>
    
        WSGIDaemonProcess downloads user=nikos group=nikos home=/home/nikos/public_html/
        WSGIScriptAlias / /home/nikos/public_html/downloads.py process-group=downloads application-group=%{GLOBAL}
    </VirtualHost>

but.... same things happen when i give their domain names, that being, 'web.py' is loading in this case as well!

Why would only 'web.py' be the only wsgi script that gets loaded?

Graham Dumpleton

unread,
Sep 7, 2018, 4:59:32 PM9/7/18
to mod...@googlegroups.com

On 8 Sep 2018, at 2:48 am, Νίκος Βέργος <nikos.at....@gmail.com> wrote:

i have this mod_wsgi configuration but onlly web.py runs normally my other 2 separate wsgi apps give a NOT found when they are tried to run through the browser.

    <Directory /home/nikos/public_html>
        AllowOverride None
        Require all granted
    </Directory>
    
    WSGIDaemonProcess downloads user=nikos group=nikos threads=5 home=/home/nikos/public_html
    WSGIScriptAlias /downloads /home/nikos/public_html/downloads.py process-group=downloads application-group=%{GLOBAL}
    
    WSGIDaemonProcess clientele user=nikos group=nikos threads=5 home=/home/nikos/public_html
    WSGIScriptAlias /clientele /home/nikos/public_html/clientele.py process-group=clientele application-group=%{GLOBAL}
    
    WSGIDaemonProcess app user=nikos group=nikos threads=5 home=/home/nikos/public_html
    WSGIScriptAlias / /home/nikos/public_html/app.py process-group=app application-group=%{GLOBAL}

for example if i try:

You are using the wrong URL.

Because you have:

    WSGIScriptAlias /clientele /home/nikos/public_html/clientele.py process-group=clientele application-group=%{GLOBAL}

The first argument to WSGIScriptAlias of '/clientele' says that is the path you should use:


If you haven't already, I would suggest perhaps read through the mod_wsgi documentation.


to get a better understand of how things work.



    Not Found
    The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

--
You received this message because you are subscribed to the Google Groups "modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To post to this group, send email to mod...@googlegroups.com.
Visit this group at https://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.

Νίκος @ SuperHost

unread,
Sep 7, 2018, 5:57:14 PM9/7/18
to mod...@googlegroups.com
Thanks Graham for everything.

I feel like an idiot. Only 1 hour before your post i realized that i was using the wrong URL.\
I didnt seee it because up until now i was writing cgi apps without flask, not wsgi with flask.

One last thing.
I want to move the directives from httpd.conf to httpd-vhosts.conf but without using a subdomain, can i just tell apache to look there for extra config for superhost.gr:80
I want this file httpdp-vhosts.cong to store the extra info for superhost.gr

You received this message because you are subscribed to a topic in the Google Groups "modwsgi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modwsgi/dAAP1mz_ekI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modwsgi+u...@googlegroups.com.

Graham Dumpleton

unread,
Sep 8, 2018, 5:38:17 PM9/8/18
to mod...@googlegroups.com
As I already explained, you can use the Include directive to have Apache read config from another file. You can't in this case have it read a separate VirtualHost. You would need to have in the separate file, just the lines you want to include in the existing VirtualHost, and then have the Include directive inside of the main VirtualHost in main config if you want to leave it there.

Νίκος @ SuperHost

unread,
Sep 8, 2018, 6:49:29 PM9/8/18
to mod...@googlegroups.com
Yes indeed, even named httpd-vhosts.conf

I noticed that wehn app.py runs in  '/' then other files within my public_html wont load like http://superhost.gr/phpmyadmin.

WSGI is contrlling the whole folder? And if so how can i still run http://superhost.gr/phpmyadmin that is placed in /home/public_html like my other 3 wsgi apps?

Graham Dumpleton

unread,
Sep 8, 2018, 7:02:12 PM9/8/18
to mod...@googlegroups.com
It gets fiddly depending on what else you have under DocumentRoot directory.

Show me the current VirtualHost definition and explain what you have under the directory referenced by DocumentRoot directory.

Also read:


for some background about the issue, but don't rush to try anything based on that just yet.

Νίκος @ SuperHost

unread,
Sep 9, 2018, 3:37:20 AM9/9/18
to mod...@googlegroups.com
Under DocumentRoot i have my 3 wsgi apps and the /phpmyadmin web  application whcih is shadowed by my Python '/' web app.
One solution i came up with last night before i see your post was to

WSGIDaemonProcess downloads user=nikos group=nikos home=/home/nikos/public_html/
WSGIScriptAlias /downloads /home/nikos/public_html/downloads.py process-group=downloads application-group=%{GLOBAL}

WSGIDaemonProcess clientele user=nikos group=nikos home=/home/nikos/public_html/
WSGIScriptAlias /clientele /home/nikos/public_html/clientele.py process-group=clientele application-group=%{GLOBAL}

WSGIDaemonProcess app user=nikos group=nikos home=/home/nikos/public_html/
WSGIScriptAlias /app /home/nikos/public_html/app.py process-group=app application-group=%{GLOBAL}
So to make wsgi listen for URL routes from '/app' and then had an index.html redirect there.
Althogh it wokrs i don't like this approache with redirection.
After reading the link iam trying to

<Directory /home/nikos/public_html>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /superhost.gr/$1 [QSA,PT,L]

    Require all granted
</Directory>


WSGIDaemonProcess downloads user=nikos group=nikos home=/home/nikos/public_html/
WSGIScriptAlias /downloads /home/nikos/public_html/downloads.py process-group=downloads application-group=%{GLOBAL}

WSGIDaemonProcess clientele user=nikos group=nikos home=/home/nikos/public_html/
WSGIScriptAlias /clientele /home/nikos/public_html/clientele.py process-group=clientele application-group=%{GLOBAL}

WSGIDaemonProcess app user=nikos group=nikos home=/home/nikos/public_html/
WSGIScriptAlias / /home/nikos/public_html/app.py process-group=app application-group=%{GLOBAL}

The wsgi apps load but NOT /phpmyadmin.

Graham Dumpleton

unread,
Sep 9, 2018, 4:32:58 AM9/9/18
to mod...@googlegroups.com
Is 'phpmyadmin' a directory under DocumentRoot, a 'phpmyadmin.php' file, or is actually in 'index.php'?

What do you get for 'ls -las' in the DocumentRoot directory?

Νίκος Βέργος

unread,
Sep 9, 2018, 4:35:28 AM9/9/18
to modwsgi
phpmyadmin is a directory under /home/nikos/public_html/

[root@superhost public_html]# ls -las
total 72
 4 drwxr-xr-x  6 nikos nikos  4096 Sep  9 11:04 .
 4 drwx--x--x 12 nikos nikos  4096 Sep  9 01:28 ..
16 -rwxr-xr-x  1 nikos nikos 13235 Sep  9 11:31 app.py
16 -rwxr-xr-x  1 nikos nikos 14901 Sep  8 16:17 clientele.py
12 -rwxr-xr-x  1 nikos nikos  9439 Sep  8 16:17 downloads.py
 4 drwxr-xr-x 11 nikos nikos  4096 Sep  9 00:11 phpmyadmin
 4 drwxr-xr-x  4 nikos nikos  4096 Sep  8 09:47 private
 4 -rw-------  1 nikos nikos  1408 Sep  8 09:47 sftp-config.json
 4 drwxr-xr-x  6 nikos nikos  4096 Sep  8 09:52 static
 4 drwxr-xr-x  2 nikos nikos  4096 Sep  8 09:52 templates

Νίκος Βέργος

unread,
Sep 9, 2018, 4:36:33 AM9/9/18
to modwsgi
phpmyadmin contain 'index.php' file.

Graham Dumpleton

unread,
Sep 9, 2018, 6:55:30 AM9/9/18
to mod...@googlegroups.com
This may or may not work depending on how PHP is setup. Add:

<Location /phpmyadmin>
SetHandler default-handler
</Location>

Graham Dumpleton

unread,
Sep 9, 2018, 7:00:39 AM9/9/18
to mod...@googlegroups.com
If that does not work, instead change:

  WSGIScriptAlias / /home/nikos/public_html/app.py process-group=app application-group=%{GLOBAL}

to:

  WSGIScriptAliasMatch ^/(?!phpmyadmin) /home/nikos/public_html/app.py process-group=app application-group=%{GLOBAL}

That is, for just app.py, change WSGIScriptAlias to WSGIScriptAliasMatch and change the first argument from '/' to:

    ^/(?!phpmyadmin)

Graham

Νίκος @ SuperHost

unread,
Sep 9, 2018, 8:36:29 AM9/9/18
to mod...@googlegroups.com
The 'location' directive did not work but the latter did!
Would you mind please exlaining it?

You received this message because you are subscribed to a topic in the Google Groups "modwsgi" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/modwsgi/dAAP1mz_ekI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to modwsgi+u...@googlegroups.com.

Νίκος @ SuperHost

unread,
Sep 9, 2018, 8:37:45 AM9/9/18
to mod...@googlegroups.com
what must i do to make the location directive to work as it is clearer for me this way?

Graham Dumpleton

unread,
Sep 9, 2018, 8:40:34 AM9/9/18
to mod...@googlegroups.com

On 9 Sep 2018, at 10:37 pm, Νίκος @ SuperHost <nikos.at....@gmail.com> wrote:

what must i do to make the location directive to work as it is clearer for me this way?

I have no idea as PHP setups can vary.

The pattern:

    ^/(?!phpmyadmin)

matches everything except a URL path starting with /phpmyadmin.

So it doesn't capture the whole site, and /phpmyadmin goes through to be processed as normal.

Νικόλαος Κούρας

unread,
Sep 9, 2018, 9:34:55 AM9/9/18
to mod...@googlegroups.com
I'am trying to run an wsgi script form within another wsgi script wit the following statement. 

pdata = subprocess.check_output( 'http://superhost.gr/' + page ) 

page = the location of another wsgi app. 

The error i'am getting is: 

mod_wsgi (pid=7152): Exception occurred processing WSGI script '/home/nikos/public_html/app.py' 
OSError: Apache/mod_wsgi failed to write response data: Broken pipe. 

The other script by itself executes normally but NOT from within my app.py script. 

Any ideas on how to execute a wsgi app (b) from within a wsgi app(a) and store the response as html data? 
Reply all
Reply to author
Forward
0 new messages