1

I'm trying to deploy my Django Project on Remote Ubuntu server with IP address: my.rm.ip.ad. And project on the Server is located at path /path/to/project. I have configured ports.conf, hosts, wsgi.py (of my Django Project) and added a website called "mywebsite" under sites-available directory and enabled it as follows.

However, I'm getting "connection refused error" when I try to connect to my.rm.ip.ad:80 . Since the port 80 looks like open, I want to ask that, where am I wrong?

Thanks in advance.

Here is my /etc/apache2/ports.conf file:

Listen 80

<IfModule ssl_module>
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
 </IfModule>

And my /etc/apache2/sites-available/mysite.conf file:

<VirtualHost my.rm.ip.ad:80>
ServerAdmin admin@mysite.com
ServerName  my.rm.ip.ad
ServerAlias http://my.rm.ip.ad
<Directory /path/to/project/ >
        Order deny,allow
        Allow from all
</Directory>
WSGIScriptAlias /  /path/to/project/foo/foo/wsgi.py
WSGIDaemonProcess  my.rm.ip.ad user=www-data group=www-data threads=25 python-path=/path/to/project/foo/foo/:/usr
WSGIProcessGroup my.rm.ip.ad
ErrorLog /path/to/project/foo/foo/error.log
</VirtualHost>

And I've added following line to /etc/hosts file:

my.rm.ip.ad my.rm.ip.ad

Lastly, here is wsgi.py file of my Django Project:

import os
import sys

sys.path.append('/path/to/project')

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Where am I wrong?

Thanks again.

cengineer
  • 1,362
  • 1
  • 11
  • 18
  • is there anything relevant in your server error logs, and have you configured your ALLOWED_HOSTS in your settings.py? – Georgina S Apr 18 '16 at 14:34
  • Dear Georgina, server error logs are empty and yes I have added 'my.rm.ip.ad' to ALLOWED_HOSTS. – cengineer Apr 18 '16 at 15:17
  • Try setting allowed hosts = ['*'], if that doesn't work i'd have a look at any firewalls the server might be running. – Georgina S Apr 18 '16 at 15:22
  • Unfortunately, statement didn't changed. I'm looking at firewall setting now. If it changes, I will Edit my post. Thanks – cengineer Apr 18 '16 at 15:25
  • Good luck with it! – Georgina S Apr 18 '16 at 15:27
  • try `netstat anp --tcp | grep 80` to see if apache is actually listening on 80 – e4c5 Apr 19 '16 at 01:28
  • Yes, server was listening but since my server is in a restricted area, my server provider said that they didn't open 80th port to worldwide. That is the problem. Thanks for all, it is solved – cengineer Apr 19 '16 at 17:10

1 Answers1

1

For ones who faced with same problem, even if it looks like listening 80th port, I suggest to ask service provider whether the port is open to worldwide or not.

My port was closed. Thus, I've faced with that kind of problem.

cengineer
  • 1,362
  • 1
  • 11
  • 18