PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, September 21, 2022

[FIXED] How to point HostGator domain to EC2 AWS

 September 21, 2022     amazon-ec2, virtualhost, web-hosting     No comments   

Issue

We have an existing domain name

(ex. webdev.com)

located in hostgator and we have a server in AWS. We wanted to use the domain name that we bought from hostgator

(webdev.com)

in our AWS server.

What we did was, in hostgator we created a DNS (project1.webdev.com) and the address is pointing to our AWS server(ex 150.12.1.0). In our AWS, we deploy the project1 under port 4000.

Now if we access the

project1.webdev.com

we end up to the default apache page. How could we route it to our port 4000 so that everytime we access project1.webdev.com it pointed to our

150.12.1.0:4000

project.

here is our virtual host config:

<VirtualHost *:4000>
ServerName project1.webdev.com
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/var/www/html/project1/web"

<Directory "/var/www/html/project1/web">
      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      Allow from all
    </Directory>

ErrorLog ${APACHE_LOG_DIR}/4000-error_log
CustomLog ${APACHE_LOG_DIR}/4000-access_log common

We have looked for several information but we did not find any possible solution. Looking forward for your help.

Thanks


Solution

You're confusing DNS, which has to do with IP addressing, with ports, which have nothing to do with DNS. DNS only deals with converting between human-readable names and IP addresses. DNS does not provide any sort of provision to perform a task like "when a user wants to make an HTTP request use port 4000 instead of port 80".

If your service is listening on port 4000 but you're using the HTTP protocol (which always uses port 80 by default) then you will need to deal with this in one of the following ways:

  • Require all URL's to explicitly specify port 4000, for example: http://project1.webdev.com:4000
  • Change your VirtualHost definition to listen on port 80 instead of 4000
  • Add a new VirtualHost definition in Apache for port 80 that proxies all requests to port 4000


Answered By - Bruce P
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing