Domain name redirects to IP address

July 1, 2013 13.8k views
I registered a new domain, changed its nameservers to point to DO's. I went to my control panel, added a new domain: maghnatis.com Now when I goto http://maghnatis.com the site redirects to the IP address. How can I keep it pointing to the domain name? And when I goto http://www.maghnatis.com (notice www.) it gives: Server not found
12 Answers
What web server do you have installed on your droplet?

Also, did you create a CNAME "www" with host "@"?
What control panel are you using? Please pastebin your virtualhost config.

As for www., dd the following CNAME record to your domain:

www CNAME @
I am not using a control panel. I installed Python, Postgers and Cassandra manually to run my site.
I'm afraid of installing a webserver with a control panel because I don't want that to erase the site I have uploaded. I would like to keep my IP address and domain name pointing to /home/mysite

And no I did not add "www" after the "@". There's an "@" on the DNS page but it says "A" not "CNAME"
Do you have Apache installed?

Re: "www" - you have to create that CNAME record in order to make the www subdomain work.
No I do not have Apache installed. Is it a must for domains to work properly?

And how do I create the CNAME record?
Do you have any kind of webserver running?

You create the DNS record using digitalocean's dns manager. Navigate to your domain in the DNS manager and click the Add record button: http://kmlnsr.me/Screenshot%20from%202013-07-01%2022%3A22%3A09.png
I don't know what kind of webserver I am running but I can assure you it is not Apache.

I used Reddit's auto-installer to install the script. The code is in Python and uses many dependencies.
Here's a list of the dependencies that were installed:

python-dev
python-setuptools
python-routes
python-pylons
python-boto
python-tz
python-crypto
python-babel
cython
python-sqlalchemy
python-beautifulsoup
python-cssutils
python-chardet
python-psycopg2
python-pycountry
python-pycassa
python-imaging
python-pycaptcha
python-amqplib
python-pylibmc
python-bcrypt
python-snudown
python-l2cs
python-lxml
python-zope.interface
python-kazoo
python-stripe

nodejs
gettext
make
optipng
jpegoptim

memcached
postgresql
postgresql-client
rabbitmq-server
cassandra
haproxy

But if you navigate to http://37.139.5.242 which is my server, the site opens.

I'm gonna create a new droplet, install apache, mysql, phpmyadmin, install zpanel (or an alternative control panel) and then I will install reddit script and specify the directory to be /var/www/mysite

But how do I tell my domain to point to it instead of another folder? and how can I cloak the domain? I don't want it to redirect to the IP address.
@george.semaan,

What type of site are you going to be running? If you're going to have a lot of static files, you might want to consider Nginx over Apache. Nginx is generally regarded is faster than Apache.

RE: zPanel, I don't have any personal experience w/it; but I've ready plenty of blogs expressing concerns over security and bugs. Recently, I installed Webmin and it's been working out pretty good.

But how do I tell my domain to point to it instead of another folder?

You don't tell the domain anything, in that regard. You specify the folder in either:
/etc/nginx/sites-available

or
/etc/apache2/sites-available

depending on which web server you go with.
http://37.139.5.242

My site is running Python code, it's not static.

I think this is the way to go. Install Apache and then install Reddit Code which is in Python.
I just installed Apache, php and mysql
Then I installed reddit using this script: https://github.com/reddit/reddit/blob/master/install-reddit.sh

I told the script to install it in /var/www/maghnatis
But if you navigate to http://37.139.4.232/maghnatis you get a directory list

Even though http://37.139.4.232/ says 'It Works'
Please list the files you have in these two directories:
/etc/apache2/sites-available

and
/etc/apache2/sites-enabled
Have another answer? Share your knowledge.