【问题标题】:How to point Godaddy Domain to Amazon EC2?如何将 Godaddy 域指向 Amazon EC2?
【发布时间】:2015-01-04 17:46:00
【问题描述】:

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

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

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

【问题讨论】:

    标签: amazon-ec2 dns


    【解决方案1】:

    某些协议(例如 XMPP)可以使用 SRV 记录,这确实允许您发布使用的端口。但是,在一般情况下,尤其是网络流量,您不能将 A 记录指向 TCP 端口。

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

    【讨论】:

      【解决方案2】:

      是的,很简单。

      • 转到 godady DNS manager 并添加一条指向您的 IP 地址的 A 类记录,如下所示。

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

      • 在您的服务器上为 7001/tcp 打开防火墙 sudo ufw allow 7001/tcp

      • 在您的服务器上运行 node.js 应用程序,然后在您的浏览器上输入 54.169.62.98:7001

      祝你好运!

      【讨论】:

        【解决方案3】:
        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>
        

        【讨论】:

          猜你喜欢
          • 2021-01-29
          • 2015-07-11
          • 2017-12-14
          • 2023-03-31
          • 1970-01-01
          • 2017-09-03
          • 2015-07-26
          • 2016-09-13
          • 2011-07-30
          相关资源
          最近更新 更多