Flask app to upload an image file via Apache 2 & WSGI not working

64 views
Skip to first unread message

Robert Kudyba

unread,
Oct 29, 2019, 3:28:50 PM10/29/19
to modwsgi

Running Apache/2.4.41 on Fedora 30 and python3-mod_wsgi-4.6.4-3.fc30.x86_64. And doing a test with: mod_wsgi-express start-server /var/www/flask/upload_pictures.wsgi --user myuser works mostly fine just uses Python 2.7 and some warnings. Browsing the URL works fine. The app just allows users to upload a picture.

[Tue Oct 29 10:05:05.365111 2019] [mpm_event:notice] [pid 17160:tid 140276832493888] AH00489: Apache/2.4.41 (Fedora) mod_wsgi/4.6.4 Python/2.7 configured -- resuming normal operations
[Tue Oct 29 10:05:05.365167 2019] [core:notice] [pid 17160:tid 140276832493888] AH00094: Command line: 'httpd (mod_wsgi-express)    -f /tmp/mod_wsgi-localhost:8000:16836/httpd.conf -D MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D FOREGROUND'
[Tue Oct 29 10:05:05.809860 2019] [wsgi:error] [pid 17162:tid 140276832493888] /usr/lib/python2.7/site-packages/nilearn/__init__.py:73: DeprecationWarning: Python2 support is deprecated and will be removed in the next release. Consider switching to Python 3.6 or 3.7.
[Tue Oct 29 10:05:05.809882 2019] [wsgi:error] [pid 17162:tid 140276832493888]   _python_deprecation_warnings()
[Tue Oct 29 10:05:38.461053 2019] [mpm_event:notice] [pid 17160:tid 140276832493888] AH00491: caught SIGTERM, shutting down
[Tue Oct 29 10:05:41.124861 2019] [mpm_event:notice] [pid 17414:tid 140153494917440] AH00489: Apache/2.4.41 (Fedora) mod_wsgi/4.6.4 Python/2.7 configured -- resuming normal operations
[Tue Oct 29 10:05:41.124923 2019] [core:notice] [pid 17414:tid 140153494917440] AH00094: Command line: 'httpd (mod_wsgi-express)    -f /tmp/mod_wsgi-localhost:8000:16836/httpd.conf -D MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D FOREGROUND'
[Tue Oct 29 10:05:41.598057 2019] [wsgi:error] [pid 17417:tid 140153494917440] /usr/lib/python2.7/site-packages/nilearn/__init__.py:73: DeprecationWarning: Python2 support is deprecated and will be removed in the next release. Consider switching to Python 3.6 or 3.7.
[Tue Oct 29 10:05:41.598077 2019] [wsgi:error] [pid 17417:tid 140153494917440]   _python_deprecation_warnings()

Here is what is in the upload_pictures.wsgi file:

#!/usr/local/bin/anaconda3/bin/python3
import sys
import logging
logging.basicConfig(stream=sys.stderr)

sys.path.insert(0, '/home/myhome/myuser/public_html')

from upload_pictures2 import app as application

application.root_path = '/home/staff/myhome/public_html'

And here is what's in the end of the httpd.conf file:

<VirtualHost *:8000>
    WSGIDaemonProcess upload_pictures2 user=apache group=apache threads=5
    WSGIScriptAlias / /var/www/flask/upload_pictures.wsgi

    <Directory /home/myhome/myuser/public_html>
        WSGIProcessGroup upload_pictures2
        WSGIApplicationGroup %{GLOBAL}
        WSGIScriptReloading On
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>

I've looked at similar issues here and here, but those don't appear to be related to my issue. I don't see any errors in the logs, and netstat -ln|grep 8000 does not show port 8000 in use. Do I have a problem with the paths?

Here are the only logs that printed:

[Tue Oct 29 10:29:47.742916 2019] [wsgi:info] [pid 26598:tid 140684965835072] mod_wsgi (pid=26598): Attach interpreter ''.
[Tue Oct 29 10:29:47.746480 2019] [wsgi:info] [pid 26598:tid 140684965835072] mod_wsgi (pid=26598): Imported 'mod_wsgi'.
[Tue Oct 29 10:29:47.746798 2019] [wsgi:debug] [pid 26598:tid 140684920149760] src/server

Graham Dumpleton

unread,
Oct 29, 2019, 3:32:14 PM10/29/19
to mod...@googlegroups.com
Where are you defining the path to upload images to? It cannot be a relative path, you need to calculate it as an absolute path. See:


Only other thing off top of my head that could be is that have SELinux enabled and it is blocking where you are writing to.

It is hard to guess without see any error message, but looks like you don't have Flask configured to log error messages and they get swallowed up.

Graham

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/cb069c88-5af3-44ac-9fa4-28586a231264%40googlegroups.com.

Robert Kudyba

unread,
Oct 29, 2019, 3:59:26 PM10/29/19
to modwsgi
SELinux is definitely disabled. When I test the app locally, all works well. I also found where you made a suggestion to try mod_wsgi-express start-server,  and that works fine, and the URL displays and the image upload works:

# mod_wsgi-express-3 setup-server upload_pictures.wsgi --port=8987 --user my --group mygroup

Server URL         : http://localhost:8987/

Server Root        : /tmp/mod_wsgi-localhost:8987:0

Server Conf        : /tmp/mod_wsgi-localhost:8987:0/httpd.conf

Error Log File     : /tmp/mod_wsgi-localhost:8987:0/error_log (warn)

Rewrite Rules      : /tmp/mod_wsgi-localhost:8987:0/rewrite.conf

Environ Variables  : /tmp/mod_wsgi-localhost:8987:0/envvars

Control Script     : /tmp/mod_wsgi-localhost:8987:0/apachectl

Request Capacity   : 5 (1 process * 5 threads)

Request Timeout    : 60 (seconds)

Startup Timeout    : 15 (seconds)

Queue Backlog      : 100 (connections)

Queue Timeout      : 45 (seconds)

Server Capacity    : 20 (event/worker), 20 (prefork)

Server Backlog     : 500 (connections)

Locale Setting     : en_US.UTF-8


 /tmp/mod_wsgi-localhost:8987:0/apachectl start


So perhaps my stanza in the httpd.conf is awry?

On Tuesday, October 29, 2019 at 3:32:14 PM UTC-4, Graham Dumpleton wrote:
Where are you defining the path to upload images to? It cannot be a relative path, you need to calculate it as an absolute path. See:


Only other thing off top of my head that could be is that have SELinux enabled and it is blocking where you are writing to.

It is hard to guess without see any error message, but looks like you don't have Flask configured to log error messages and they get swallowed up.

Graham

On 30 Oct 2019, at 2:50 am, Robert Kudyba <rku...@fordham.edu> wrote:

Running Apache/2.4.41 on Fedora 30 and python3-mod_wsgi-4.6.4-3.fc30.x86_64. And doing a test with: mod_wsgi-express start-server /var/www/flask/upload_pictures.wsgi --user myuser works mostly fine just uses Python 2.7 and some warnings. Browsing the URL works fine. The app just allows users to upload a picture.

[Tue Oct 29 10:05:05.365111 2019] [mpm_event:notice] [pid 17160:tid 140276832493888] AH00489: Apache/2.4.41 (Fedora) mod_wsgi/4.6.4 Python/2.7 configured -- resuming normal operations
[Tue Oct 29 10:05:05.365167 2019] [core:notice] [pid 17160:tid 140276832493888] AH00094: Command line: 'httpd (mod_wsgi-express)    -f /tmp/mod_wsgi-localhost:8000:16836/httpd.conf -D MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D FOREGROUND'
[Tue Oct 29 10:05:05.809860 2019] [wsgi:error] [pid 17162:tid 140276832493888] /usr/lib/python2.7/site-packages/nilearn/__init__.py:73: DeprecationWarning: Python2 support is deprecated and will be removed in the next release. Consider switching to Python 3.6 or 3.7.
[Tue Oct 29 10:05:05.809882 2019] [wsgi:error] [pid 17162:tid 140276832493888]   _python_deprecation_warnings()
[Tue Oct 29 10:05:38.461053 2019] [mpm_event:notice] [pid 17160:tid 140276832493888] AH00491: caught SIGTERM, shutting down
[Tue Oct 29 10:05:41.124861 2019] [mpm_event:notice] [pid 17414:tid 140153494917440] AH00489: Apache/2.4.41 (Fedora) mod_wsgi/4.6.4 Python/2.7 configured -- resuming normal operations
[Tue Oct 29 10:05:41.124923 2019] [core:notice] [pid 17414:tid 140153494917440] AH00094: Command line: 'httpd (mod_wsgi-express)    -f /tmp/mod_wsgi-localhost:8000:16836/httpd.conf -D MOD_WSGI_MPM_ENABLE_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_EVENT_MODULE -D MOD_WSGI_MPM_EXISTS_WORKER_MODULE -D MOD_WSGI_MPM_EXISTS_PREFORK_MODULE -D FOREGROUND'
[Tue Oct 29 10:05:41.598057 2019] [wsgi:error] [pid 17417:tid 140153494917440] /usr/lib/python2.7/site-packages/nilearn/__init__.py:73: DeprecationWarning: Python2 support is deprecated and will be removed in the next release. Consider switching to Python 3.6 or 3.7.
[Tue Oct 29 10:05:41.598077 2019] [wsgi:error] [pid 17417:tid 140153494917440]   _python_deprecation_warnings()

Here is what is in the upload_pictures.wsgi file:

#!/usr/local/bin/anaconda3/bin/python3
import sys
import logging
logging.basicConfig(stream=sys.stderr)

sys.path.insert(0, '/home/myhome/myuser/public_
html')

from upload_pictures2 import app as application

application.root_path = '/home/myhome/myuser/public_html'

And here is what's in the end of the httpd.conf file:

<VirtualHost *:8000>
    WSGIDaemonProcess upload_pictures2 user=apache group=apache threads=5
    WSGIScriptAlias / /var/www/flask/upload_pictures.wsgi

    <Directory /home/myhome/myuser/public_html>
        WSGIProcessGroup upload_pictures2
        WSGIApplicationGroup %{GLOBAL}
        WSGIScriptReloading On
        Order deny,allow
        Allow from all
    </Directory>
</VirtualHost>

I've looked at similar issues here and here, but those don't appear to be related to my issue. I don't see any errors in the logs, and netstat -ln|grep 8000 does not show port 8000 in use. Do I have a problem with the paths?

Here are the only logs that printed:

[Tue Oct 29 10:29:47.742916 2019] [wsgi:info] [pid 26598:tid 140684965835072] mod_wsgi (pid=26598): Attach interpreter ''.
[Tue Oct 29 10:29:47.746480 2019] [wsgi:info] [pid 26598:tid 140684965835072] mod_wsgi (pid=26598): Imported 'mod_wsgi'.
[Tue Oct 29 10:29:47.746798 2019] [wsgi:debug] [pid 26598:tid 140684920149760] src/server

--
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 mod...@googlegroups.com.

Graham Dumpleton

unread,
Oct 29, 2019, 5:18:04 PM10/29/19
to mod...@googlegroups.com
As I already asked, how is the path for where you are storing the upload calculated? What is the code and any configuration?

To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/5d2ebb75-aeb9-4c50-8462-60246aed3965%40googlegroups.com.

Robert Kudyba

unread,
Oct 29, 2019, 8:29:01 PM10/29/19
to modwsgi
Below is a snip of the app code. I didn't think it was relevant as the page doesn't even load, i.e., before the submit. And since I got it working with mod_wsgi-express start-server I thought it had to be something in the httpd.conf file. 

from flask import Flask, render_template, request, redirect, url_for, make_response,jsonify

from werkzeug.utils import secure_filename

import os

import cv2

import time

from scipy import ndimage

from datetime import timedelta

import nibabel as nib

import numpy as np

import matplotlib.pyplot as plt

import nilearn

from nilearn import plotting

from nilearn import image

 

ALLOWED_EXTENSIONS = set(['png', 'jpg', 'JPG', 'PNG', 'bmp','nii.gz','nii'])

 

def allowed_file(filename):

    return '.' in filename and filename.rsplit('.', 2)[1] in ALLOWED_EXTENSIONS

 

app = Flask(__name__)

app.send_file_max_age_default = timedelta(seconds=1)


def show_slices(slices):

    """ Function to display row of image slices """

    fig, axes = plt.subplots(1, len(slices))

    for i, slice in enumerate(slices):

        axes[i].imshow(slice.T, cmap="gray", origin="lower")

    

    


# @app.route('/upload', methods=['POST', 'GET'])

@app.route('/upload', methods=['POST', 'GET'])

def upload():

    if request.method == 'POST':

        f = request.files['file']

 

        if not (f and allowed_file(f.filename)):

            return jsonify({"error": 1001, "msg": "png,PNG,jpg,JPG,bmp"})

 

        user_input = request.form.get("name")

        user_input1 = request.form.get("name1")

        user_input2 = request.form.get("name2")

        a = int(user_input)

        b = int(user_input1)

        c = int(user_input2)

        

        basepath = os.path.dirname(__file__) 

 

        upload_path = os.path.join(basepath, 'static/images', secure_filename(f.filename))  

        # upload_path = os.path.join(basepath, 'static/images','test.jpg')  

        f.save(upload_path)

 

        epi_img = nib.load(upload_path)

        epi_img_data = epi_img.get_fdata()

        shape = epi_img_data.shape

        x = shape[0] - 1

Graham Dumpleton

unread,
Oct 29, 2019, 10:02:28 PM10/29/19
to mod...@googlegroups.com
Is your directory where images are to be stored writable to the user that Apache runs your code?

To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/45c34fca-e907-4b87-bad4-3ab81e5962bd%40googlegroups.com.

Robert Kudyba

unread,
Oct 29, 2019, 10:19:22 PM10/29/19
to modwsgi
Absolutely. Image uploads work with mod_wsgi-express start-server.

Graham Dumpleton

unread,
Oct 29, 2019, 10:22:03 PM10/29/19
to mod...@googlegroups.com
When you run 'mod_wsgi-express start-server' it runs as you and is not the same.

Apache is going to run it as the Apache user, which may not have the same access.

Change user and group in:

WSGIDaemonProcess upload_pictures2 user=apache group=apache threads=5

to what user has access to the directory to write files.

Graham

> On 30 Oct 2019, at 1:19 pm, Robert Kudyba <rku...@fordham.edu> wrote:
>
> Absolutely. Image uploads work with mod_wsgi-express start-server.
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/455d6200-2a0b-4ef2-92dd-15ed6f8c819d%40googlegroups.com.

Robert Kudyba

unread,
Oct 30, 2019, 9:37:12 AM10/30/19
to modwsgi
Good thought. But I tried changing to the corresponding user & group, and still no luck. Even added the user to the apache group just to make sure. Logs just show this:
[Wed Oct 30 09:33:32.043767 2019] [wsgi:info] [pid 3980:tid 140481291338048] mod_wsgi (pid=3980): Attach interpreter ''.
[Wed Oct 30 09:33:32.047098 2019] [wsgi:info] [pid 3980:tid 140481291338048] mod_wsgi (pid=3980): Imported 'mod_wsgi'.
[Wed Oct 30 09:33:32.047324 2019] [wsgi:debug] [pid 3980:tid 140481237260032] src/server/mod_wsgi.c(9068): mod_wsgi (pid=3980): Started thread 1 in daemon process 'upload_pictures2'.
[Wed Oct 30 09:33:32.047400 2019] [wsgi:debug] [pid 3980:tid 140481245652736] src/server/mod_wsgi.c(9068): mod_wsgi (pid=3980): Started thread 0 in daemon process 'upload_pictures2'.
[Wed Oct 30 09:33:32.047411 2019] [wsgi:debug] [pid 3980:tid 140481212081920] src/server/mod_wsgi.c(9068): mod_wsgi (pid=3980): Started thread 4 in daemon process 'upload_pictures2'.
[Wed Oct 30 09:33:32.047440 2019] [wsgi:debug] [pid 3980:tid 140481228867328] src/server/mod_wsgi.c(9068): mod_wsgi (pid=3980): Started thread 2 in daemon process 'upload_pictures2'.
[Wed Oct 30 09:33:32.047441 2019] [wsgi:debug] [pid 3980:tid 140481220474624] src/server/mod_wsgi.c(9068): mod_wsgi (pid=3980): Started thread 3 in daemon process 'upload_pictures2'.

And curl fails:

curl: (7) Failed to connect to 127.0.0.1 port 8000: Connection refused

curl: (7) Failed to connect to 127.0.0.1 port 8000: Connection refused

On Tuesday, October 29, 2019 at 10:22:03 PM UTC-4, Graham Dumpleton wrote:
When you run 'mod_wsgi-express start-server' it runs as you and is not the same.

Apache is going to run it as the Apache user, which may not have the same access.

Change user and group in:

WSGIDaemonProcess upload_pictures2 user=apache group=apache threads=5

to what user has access to the directory to write files.

Graham

> On 30 Oct 2019, at 1:19 pm, Robert Kudyba <rku...@fordham.edu> wrote:
>
> Absolutely. Image uploads work with mod_wsgi-express start-server.
>
> --
> 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 mod...@googlegroups.com.

Graham Dumpleton

unread,
Oct 30, 2019, 9:50:22 PM10/30/19
to mod...@googlegroups.com
If port 8000 is refusing connections, that shouldn't be related to the WSGI application as it is Apache that handles connections. So Apache would appear not to be running or you have mucked up something in the Apache configuration to disable the VirtualHost.

To unsubscribe from this group and stop receiving emails from it, send an email to modwsgi+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/a3daa6a9-4c18-4e5e-9410-b5a71e7a7fee%40googlegroups.com.

Robert Kudyba

unread,
Oct 31, 2019, 10:10:57 AM10/31/19
to modwsgi
Apache is running just fine. We run Squirrelmail and sendmail for legacy email purposes and also have a few web pages running ok. We do enable SSL, e.g.,:
Listen 443 https
SSLEngine on
And enabled UserDir:
UserDir public_html

Since there are some logs being produced by mod_wsgi as shown in the log snippets, and mod_wsgi-express start-server works, I agree there is something within the Apache configuration. We do have some RewriteEngine rules:
RewriteEngine on
RewriteCond %{SERVER_NAME} =oursubdomain.ourschool.edu [OR]
RewriteCond %{SERVER_NAME} =*. oursubdomain.ourschool.edu
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

We do have a separate tool called sendmailanalyzer running just fine as well, which works on port 443.

So could some of these settings be causing any port I try to not be available? 

Also wanted to show a (different) port in use with mod_wsgi-express:
netstat -ln|grep 8987
tcp6       0      0 :::8987                 :::*                    LISTEN     
unix  2      [ ACC ]     STREAM     LISTENING     222147816 /tmp/mod_wsgi-localhost:8987:0/wsgi.25662.u16836.1.sock

Robert Kudyba

unread,
Oct 31, 2019, 11:50:13 AM10/31/19
to modwsgi
So I captured some http and curl traffic via a tcpdump to the port. Not sure if it helps.

tcpdump -i any port 8000 -v
dropped privs to tcpdump
tcpdump: listening on any, link-type LINUX_SLL (Linux cooked v1), capture size 262144 bytes

11:43:26.930648 IP (tos 0x0, ttl 64, id 10249, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57402 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0x6c70), seq 2393150000, win 65495, options [mss 65495,sackOK,TS val 152615465 ecr 0,nop,wscale 7], length 0
11:43:26.930672 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57402: Flags [R.], cksum 0x917d (correct), seq 0, ack 2393150001, win 0, length 0
11:43:27.187561 IP (tos 0x0, ttl 64, id 49632, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57404 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xc8ba), seq 1219328730, win 65495, options [mss 65495,sackOK,TS val 152615722 ecr 0,nop,wscale 7], length 0
11:43:27.187585 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57404: Flags [R.], cksum 0xeec8 (correct), seq 0, ack 1219328731, win 0, length 0
11:43:27.846341 IP (tos 0x0, ttl 64, id 2073, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57410 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0x738d), seq 1615377876, win 65495, options [mss 65495,sackOK,TS val 152616380 ecr 0,nop,wscale 7], length 0
11:43:27.846370 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57410: Flags [R.], cksum 0x9c2d (correct), seq 0, ack 1615377877, win 0, length 0
11:43:27.852161 IP (tos 0x0, ttl 64, id 33508, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57412 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xc306), seq 2271493943, win 65495, options [mss 65495,sackOK,TS val 152616386 ecr 0,nop,wscale 7], length 0
11:43:27.852180 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57412: Flags [R.], cksum 0xebac (correct), seq 0, ack 2271493944, win 0, length 0
11:43:27.852513 IP (tos 0x0, ttl 64, id 48347, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57414 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xf501), seq 2476015880, win 65495, options [mss 65495,sackOK,TS val 152616387 ecr 0,nop,wscale 7], length 0
11:43:27.852526 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57414: Flags [R.], cksum 0x1da9 (correct), seq 0, ack 2476015881, win 0, length 0
11:44:11.812287 IP (tos 0x0, ttl 64, id 30322, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57420 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0x0591), seq 3092717561, win 65495, options [mss 65495,sackOK,TS val 152660346 ecr 0,nop,wscale 7], length 0
11:44:11.812311 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57420: Flags [R.], cksum 0xd9ef (correct), seq 0, ack 3092717562, win 0, length 0
11:44:12.216891 IP (tos 0x0, ttl 64, id 51676, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57422 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xa6fa), seq 2454954748, win 65495, options [mss 65495,sackOK,TS val 152660751 ecr 0,nop,wscale 7], length 0
11:44:12.216914 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57422: Flags [R.], cksum 0x7cee (correct), seq 0, ack 2454954749, win 0, length 0
11:44:12.408444 IP (tos 0x0, ttl 64, id 23494, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57424 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xaac0), seq 11546649, win 65495, options [mss 65495,sackOK,TS val 152660942 ecr 0,nop,wscale 7], length 0
11:44:12.408463 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57424: Flags [R.], cksum 0x8173 (correct), seq 0, ack 11546650, win 0, length 0
11:44:12.624112 IP (tos 0x0, ttl 64, id 31243, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57426 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xedfe), seq 3589543612, win 65495, options [mss 65495,sackOK,TS val 152661158 ecr 0,nop,wscale 7], length 0
11:44:12.624135 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57426: Flags [R.], cksum 0xc589 (correct), seq 0, ack 3589543613, win 0, length 0
11:44:12.789988 IP (tos 0x0, ttl 64, id 55076, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57428 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xbcbf), seq 1657715321, win 65495, options [mss 65495,sackOK,TS val 152661324 ecr 0,nop,wscale 7], length 0
11:44:12.790010 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57428: Flags [R.], cksum 0x94f0 (correct), seq 0, ack 1657715322, win 0, length 0
11:44:12.909253 IP (tos 0x0, ttl 64, id 20180, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57430 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xc93a), seq 3981648640, win 65495, options [mss 65495,sackOK,TS val 152661443 ecr 0,nop,wscale 7], length 0
11:44:12.909274 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57430: Flags [R.], cksum 0xa1e2 (correct), seq 0, ack 3981648641, win 0, length 0
11:44:12.948622 IP (tos 0x0, ttl 64, id 51105, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57432 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xee12), seq 1089972826, win 65495, options [mss 65495,sackOK,TS val 152661483 ecr 0,nop,wscale 7], length 0
11:44:12.948654 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57432: Flags [R.], cksum 0xc6e2 (correct), seq 0, ack 1089972827, win 0, length 0
11:44:13.230395 IP (tos 0x0, ttl 64, id 14368, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57434 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0x366c), seq 1252546357, win 65495, options [mss 65495,sackOK,TS val 152661764 ecr 0,nop,wscale 7], length 0
11:44:13.230417 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57434: Flags [R.], cksum 0x1055 (correct), seq 0, ack 1252546358, win 0, length 0
11:44:13.234738 IP (tos 0x0, ttl 64, id 26047, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57436 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0xb792), seq 369822373, win 65495, options [mss 65495,sackOK,TS val 152661769 ecr 0,nop,wscale 7], length 0
11:44:13.234753 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57436: Flags [R.], cksum 0x9180 (correct), seq 0, ack 369822374, win 0, length 0
11:44:13.235092 IP (tos 0x0, ttl 64, id 24010, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57438 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0x44b5), seq 1622880976, win 65495, options [mss 65495,sackOK,TS val 152661769 ecr 0,nop,wscale 7], length 0
11:44:13.235104 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57438: Flags [R.], cksum 0x1ea3 (correct), seq 0, ack 1622880977, win 0, length 0

11:44:39.402832 IP (tos 0x0, ttl 64, id 26573, offset 0, flags [DF], proto TCP (6), length 60)
    subdomain.ourschool.edu.57440 > subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xfe30 (incorrect -> 0x81b6), seq 1034990239, win 65495, options [mss 65495,sackOK,TS val 152687937 ecr 0,nop,wscale 7], length 0
11:44:39.402854 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    subdomain.ourschool.edu.irdmi > subdomain.ourschool.edu.57440: Flags [R.], cksum 0xc1dc (correct), seq 0, ack 1034990240, win 0, length 0
11:44:39.403039 IP (tos 0x0, ttl 64, id 54374, offset 0, flags [DF], proto TCP (6), length 60)
    storm.subdomain.ourschool.edu.45416 > storm.subdomain.ourschool.edu.irdmi: Flags [S], cksum 0xb53b (incorrect -> 0x463a), seq 2920218932, win 65495, options [mss 65495,sackOK,TS val 2518105273 ecr 0,nop,wscale 7], length 0
11:44:39.403052 IP (tos 0x0, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40)
    storm.subdomain.ourschool.edu.irdmi > storm.subdomain.ourschool.edu.45416: Flags [R.], cksum 0x7ad6 (correct), seq 0, ack 2920218933, win 0, length 

Robert Kudyba

unread,
Nov 7, 2019, 10:29:55 AM11/7/19
to modwsgi
Hello Graham,

I managed to get this working outside of an entry in httpd.conf but I'd like to figure out what is stopping me from using it. We do redirect all http to https.

1) What I did to make it work was create a file  /var/www/flask/upload_pictures.wsgi containing:
sys.path.insert(0, '/home/students/student-a/public_html')
from upload_pictures import app as application
application.root_path = '/home/students/student-a/public_html'

2) I run this command:
mod_wsgi-express-3 setup-server upload_pictures.wsgi --port=8987 --user student-a --group students

3) this outputs:
Control Script     : /tmp/mod_wsgi-localhost:8987:0/apachectl

4) Then I run: 
  /tmp/mod_wsgi-localhost:8987:0/apachectl  start 

But this won't start up automatically if/when the server reboots. Any other debugging tips? Thanks for your replies.

Graham Dumpleton

unread,
Nov 8, 2019, 1:10:50 AM11/8/19
to mod...@googlegroups.com
Are your redirect rules for the hostname inside of a VirtualHost or outside.

Only thing can guess is that you have it outside and when you request 127.0.0.1, it is redirected to the hostname, but for that hostname it is not matching a VirtualHost which listens on port 8000 since no ServerName in that VirtualHost.

What are all the headers for request/response when use -v with curl. Does it show that it is following a redirect and the connection failure is for the redirected request?

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/modwsgi/04d68b95-de14-41d3-9f20-3434423ae429%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages