End of script output before headers: wsgi.py (RHEL 7)

1,219 views
Skip to first unread message

alansnow21

unread,
Sep 22, 2015, 1:19:16 PM9/22/15
to Tethys Platform

When I try to load the page I get an internal server error:

$ wget http://localhost/test

--2015-09-22 13:06:43--  http://localhost/test

Resolving localhost (localhost)... ::1, 127.0.0.1

Connecting to localhost (localhost)|::1|:80... connected.

HTTP request sent, awaiting response... 500 Internal Server Error

2015-09-22 13:06:44 ERROR 500: Internal Server Error.


Here is the end of /etc/httpd/conf/httpd.conf:

```

WSGIPythonHome /usr/local/pythonenv/BASELINE

#http://stackoverflow.com/questions/4501817/django-apache-mod-wsgi-error-premature-end-of-script-headers

#Note: tried this and it did not change anything

#WSGIApplicationGroup %{GLOBAL}

```

So, in the error logs:

```

$ tail /var/log/httpd/tethys_default.error.log

```

it says: End of script output before headers: wsgi.py



Here is /etc/httpd/conf.d/tethys-default.conf:

```

#I have tried with and without commented lines and nothing changed.

#WSGISocketPrefix run/wsgi

#WSGIPythonHome /usr/local/pythonenv/BASELINE


#WSGIPythonPath /usr/lib/tethys/lib/python2.7:/usr/lib/tethys/lib/python2.7/site-packages:/var/www/tethys/apps


<VirtualHost 0.0.0.0:80>

    ServerName ...

    ServerAlias ...

    Alias /static/ /var/www/tethys/static/

    <Directory /var/www/tethys/static/>

         Require all granted

    </Directory>

    WSGIScriptAlias / /usr/lib/tethys/src/tethys_portal/wsgi.py

    <Directory /usr/lib/tethys/src/tethys_portal>

        <Files wsgi.py>

              Require all granted

        </Files>

    </Directory>

    # Daemon config

    WSGIDaemonProcess tethys_default \

     python-path=/usr/lib/tethys/src/tethys_portal:/usr/lib/tethys/lib/python2.7/site-packages:/var/www/tethys/apps

    WSGIProcessGroup tethys_default

    #Logs

    ErrorLog /var/log/httpd/tethys_default.error.log

    CustomLog /var/log/httpd/tethys_default.custom.log combined

</VirtualHost>

```


Any input would be appreciated!


Thanks!

Zhiyu Li

unread,
Sep 22, 2015, 1:24:38 PM9/22/15
to alansnow21, Tethys Platform
Alan,

Is your SELinux on? Try to disable it. On CentOS the command is:
sudo nano /etc/sysconfig/selinux
#change to Disabled
sudo reboot

Drew

--
You received this message because you are subscribed to the Google Groups "Tethys Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tethysplatfor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tethysplatform/0c912854-fe23-4eed-937e-e11cc4403290%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nathan Swain

unread,
Sep 22, 2015, 1:25:29 PM9/22/15
to alansnow21, Tethys Platform
Did you add 'localhost' to the ALLOWED_HOSTS parameter in the settings.py?

--
You received this message because you are subscribed to the Google Groups "Tethys Platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tethysplatfor...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tethysplatform/0c912854-fe23-4eed-937e-e11cc4403290%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nathan Swain

alansnow21

unread,
Sep 22, 2015, 2:08:15 PM9/22/15
to Tethys Platform, alans...@gmail.com
Hi Drew,

You hit the nail on the head. Yep, SELinux did it. I put it in permissive mode, and it worked.

Thanks!

Zhiyu Li

unread,
Sep 22, 2015, 2:12:49 PM9/22/15
to alansnow21, Nathan Swain, Tethys Platform
Alan -- I am glad it is working.

Nathan -- maybe it is better to add SELinux in the doc as a FAQ

Thanks
Drew

Nathan Swain

unread,
Sep 22, 2015, 7:02:46 PM9/22/15
to Zhiyu Li, alansnow21, Tethys Platform
I don't think it should be our policy to tell people to disable SELinux. It poses a significant security risk. One of the reasons people use RedHat as servers is because of the increased security SELinux provides. We need to find the solution without disabling SELinux and recommend that.
--
Nathan Swain

alansnow21

unread,
Sep 23, 2015, 11:45:22 AM9/23/15
to Tethys Platform, zyli...@gmail.com, alans...@gmail.com
Here is a suggestion for SELinux Troubleshooting for y'all to try out and add suggestions to: https://github.com/tethysplatform/tethys/issues/136

swainn

unread,
Nov 4, 2015, 2:30:52 PM11/4/15
to Tethys Platform, zyli...@gmail.com, alans...@gmail.com
Thanks Alan. That is a good way to troubleshoot SELinux issues. Just be sure not to leave it in permissive mode. That would be the same as turning it off all together.
Reply all
Reply to author
Forward
0 new messages