我在Amazon EC2实例上运行Node.JS HTTP服务器。
我的IP地址和端口是54.169.62.98:7001。如何将Godaddy域指向此IP和端口?
是否可以使用80以外的端口?
答案 0 :(得分:0)
某些协议(如XMPP)可以使用SRV记录,它允许您发布使用的端口。但是,在一般情况下,尤其是Web流量,您无法将A记录指向TCP端口。
听起来您希望让Node在端口80上侦听,或者在EC2实例上安装反向代理(例如Nginx)以将端口80
上的流量转发到127.0.0.1:7001
。有simple guide here。
答案 1 :(得分:0)
是的,简单。
祝你好运!答案 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>