Django accepting other applications ports

25 views
Skip to first unread message

Sven Mäurer

unread,
Mar 25, 2015, 4:12:15 PM3/25/15
to django...@googlegroups.com

I have two applications on my apache. Why is my Django application running accepting the connection also of port 8888?

Listen 8787
<VirtualHost 81.169.229.41:8787>



The other application:

Listen 8888
<VirtualHost 81.169.229.41:8888>

Gergely Polonkai

unread,
Mar 25, 2015, 7:22:05 PM3/25/15
to django...@googlegroups.com

Hello,

Please share the rest of this Apache config; from what you copied, it's impossible to tell.

Best,
Gergely

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f512ca44-b7fc-4e26-8c56-7cb325e1f6dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sven Mäurer

unread,
Mar 25, 2015, 7:27:44 PM3/25/15
to django...@googlegroups.com

backend.conf

Listen 8787

WSGIScriptAlias / /var/www/html/backend/API/wsgi.py
WSGIPythonPath /var/www/html/backend:/var/www/html/backend/venv/lib/python2.7/site-packages
WSGIPassAuthorization On

<VirtualHost 81.169.229.41:8787>
        DocumentRoot /var/www/html/backend
        <Directory API/>
                <Files wsgi.py>
                        Require all granted
                </Files>
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>


website.conf

Listen 8888

<VirtualHost 81.169.229.41:8888>

        DocumentRoot /var/www/html/website
        <Directory />
                Options FollowSymLinks
                AllowOverride All
        </Directory>
        <Directory /var/www>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order Allow,Deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Stephen J. Butler

unread,
Mar 25, 2015, 8:57:19 PM3/25/15
to django...@googlegroups.com
On Wed, Mar 25, 2015 at 2:27 PM, Sven Mäurer <maeure...@gmail.com> wrote:
> backend.conf
>
> Listen 8787
>
> WSGIScriptAlias / /var/www/html/backend/API/wsgi.py
> WSGIPythonPath
> /var/www/html/backend:/var/www/html/backend/venv/lib/python2.7/site-packages
> WSGIPassAuthorization On

WSGIScriptAlias belongs in your VirtualHost, not at the server config
level. Also...

> <VirtualHost 81.169.229.41:8787>
> DocumentRoot /var/www/html/backend
> <Directory API/>
> <Files wsgi.py>
> Require all granted
> </Files>
> </Directory>
>
> ErrorLog ${APACHE_LOG_DIR}/error.log
> CustomLog ${APACHE_LOG_DIR}/access.log combined
>
> </VirtualHost>

This is dangerous. You should never set your DocumentRoot to be where
your code is. A minor misconfiguration in your apache setup could
expose all your source code! Instead set your document root to
something empty (or maybe containing your static files directory) and
do this:

WSGIPythonPath /var/www/python/backend:/var/www/python/venv/lib/python2.7/site-packages

<VirtualHost blah>
DocumentRoot /var/www/html
WSGIScriptAlias / /var/www/python/API/wsgi.py
<Directory /var/www/python/backend/API/>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>
</VirtualHost>

Sven Mäurer

unread,
Mar 25, 2015, 9:06:09 PM3/25/15
to django...@googlegroups.com
Ohh thanks. You have saved at least 4 hours of my sleep, 10 coffees and a very bad mood!
Reply all
Reply to author
Forward
0 new messages