如何将Godaddy Domain指向Amazon EC2?

时间:2015-01-04 17:46:01

标签: amazon-ec2 dns

我在Amazon EC2实例上运行Node.JS HTTP服务器。

我的IP地址和端口是54.169.62.98:7001。如何将Godaddy域指向此IP和端口?

是否可以使用80以外的端口?

3 个答案:

答案 0 :(得分:0)

某些协议(如XMPP)可以使用SRV记录,它允许您发布使用的端口。但是,在一般情况下,尤其是Web流量,您无法将A记录指向TCP端口。

听起来您希望让Node在端口80上侦听,或者在EC2实例上安装反向代理(例如Nginx)以将端口80上的流量转发到127.0.0.1:7001。有simple guide here

答案 1 :(得分:0)

是的,简单。

  • 转到godady DNS管理器并添加指向您的IP地址的A类记录,如下所述。enter image description here

  • 然后转到您的aws-ec2控制台并在AWS安全组下添加自定义入站TCP规则,如下所示。 enter image description here

  • 在服务器上为7001 / tcp打开防火墙sudo ufw allow 22
  • 在您的服务器上运行node.js应用,然后在浏览器中输入54.169.62.98:7001
祝你好运!

答案 2 :(得分:0)

Yes, you can point any instance of AWS via GoDaddy domain. You have to save A record for hit your instance via host @ and point to your IP(54.169.62.98), after this you can hit you IP but not port 7001, for port distribution you will have to some config some file.
  

对于虚拟主机

<VirtualHost *:80>
ProxyPreserveHost On
ProxyRequests Off
ServerName www.example.org
ServerAlias example.org
Redirect permanent / https://example.org/
</VirtualHost>
  

对于ssl配置

<IfModule mod_ssl.c>
      <VirtualHost *:443>
              ServerAdmin webmaster@localhost
              ServerName example.org
              DocumentRoot /var/www/html
              ProxyPreserveHost On
              ProxyRequests Off
              ProxyPass / http://localhost:7001/
              ProxyPassReverse / http://localhost:7001/
              ErrorLog ${APACHE_LOG_DIR}/error.log
              CustomLog ${APACHE_LOG_DIR}/access.log combined
              SSLEngine on
              SSLProtocol all -SSLv2 -SSLv3
              SSLCertificateFile /home/ubuntu/today.crt
              SSLCertificateKeyFile /home/ubuntu/today.key
              SSLCertificateChainFile /home/ubuntu/intermediate.crt
              SSLCACertificateFile /home/ubuntu/intermediate.crt
              <FilesMatch "\.(cgi|shtml|phtml|php)$">
                              SSLOptions +StdEnvVars
              </FilesMatch>
              <Directory /usr/lib/cgi-bin>
                              SSLOptions +StdEnvVars
              </Directory>
              BrowserMatch "MSIE [2-6]" \
                              nokeepalive ssl-unclean-shutdown \
                              downgrade-1.0 force-response-1.0
              BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
      </VirtualHost>
</IfModule>