Domain not working without :8000 on dev

April 11, 2018 390 views
Applications Ubuntu 16.04

Hello,

My domain http://www.superlists-staging.xyz:8000/ is working but http://www.superlists-staging.xyz/ not working and having - HTTP ERROR 404.

The Django dev server is running at 0.0.0.0:8000.

Appreciate anyone can help.

Regards

4 Answers
syedarizona April 12, 2018
Accepted Answer

@ryanpq

I am using /virtualenv/bin/python manage.py runserver 0.0.0.0:8000 for now for the test purpose. I log to my droplet using ssh from my mac. I did not setup any web server. I have amended the Django settings.py as shown below:

SECURITY WARNING: don't run with debug turned on in production!

DEBUG = True

ALLOWED_HOSTS = ['*']

Let me know if you need more info.

Regards

It would appear that while you're able to access your Django instance directly on port 8000 your web server is not configured properly to proxy those connections when you are trying to access it via port 80 (the default).

Which web server are you using? Nginx or Apache?

If you can share your site configuration (/etc/nginx/sites-enabled or /etc/apache2/sites-enabled) we can likely help you make the adjustments needed to access your site on the default http port.

Once that is working you'll likely want to change your Django setup to listen on 127.0.0.1:8000 or localhost:8000 (this way it would only be accessible through the web proxy and would no longer appear on port 8000 publicly.

  • Hi,

    I couldn't find apache2 or nginx in the /etc/ folder. Appreciate your help.

    sudo ls /etc/
    acpi calendar dpkg hosts ldap magic nsswitch.conf protocols rmt subgid update-motd.d
    adduser.conf cloud ec2version hosts.allow ld.so.cache magic.mime opt python rpc subgid- update-notifier
    alternatives console-setup environment hosts.deny ld.so.conf mailcap os-release python2.7 rsyslog.conf subuid vim
    apm cron.d fonts init ld.so.conf.d mailcap.order overlayroot.conf python3 rsyslog.d subuid- vmware-tools
    apparmor cron.daily fstab init.d legal manpath.config overlayroot.local.conf python3.5 screenrc sudoers vtrgb
    apparmor.d cron.hourly fuse.conf initramfs-tools libaudit.conf mdadm pam.conf python3.6 securetty sudoers.d wgetrc
    apport cron.monthly gai.conf inputrc locale.alias mime.types pam.d rc0.d security sysctl.conf X11
    apt crontab groff insserv locale.gen mke2fs.conf passwd rc1.d selinux sysctl.d xdg
    at.deny cron.weekly group insserv.conf localtime modprobe.d passwd- rc2.d services systemd xml
    bash.bashrc crypttab group- insserv.conf.d logcheck modules perl rc3.d sgml terminfo zsh
    commandnotfound
    bashcompletion dbus-1 grub.d iproute2 login.defs modules-load.d pm rc4.d shadow timezone
    bash
    completion.d debconf.conf gshadow iscsi logrotate.conf mtab polkit-1 rc5.d shadow- tmpfiles.d
    bindresvport.blacklist debian_version gshadow- issue logrotate.d nanorc pollinate rc6.d shells ucf.conf
    binfmt.d default gss issue.net lsb-release network popularity-contest.conf rc.local skel udev
    byobu deluser.conf hdparm.conf kbd ltrace.conf NetworkManager ppp rcS.d sos.conf ufw
    ca-certificates depmod.d host.conf kernel lvm networks profile resolvconf ssh updatedb.conf
    ca-certificates.conf dhcp hostname kernel-img.conf machine-id newt profile.d resolv.conf ssl update-manager

    Regards

@ryanpq

Thanks for the response. Since I am at work right now I will update this thread as soon as I get hold of my Mac at home.

Regards

Have another answer? Share your knowledge.