1
我有一個運行Ubuntu的AWS EC2實例,我想用Nginx配置。我的理解是,如果Nginx正在運行,並且我已經正確配置了我的服務器塊,那麼我應該能夠在我的虛擬機之外修改我的主機文件,以便從自定義域中提供公共IP。無法通過Nginx從本地機器連接到AWS EC2
在我的實例所以,Nginx的是細運行:
~$ /etc/init.d/nginx status
* nginx is running
我的服務器塊,位於/etc/nginx/sites-available/example.com
(這被鏈接到sites-enabled
)如下:
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /var/www/example;
index index.html index.htm;
server_name local.example.com local.www.example.com;
location/{
try_files $uri $uri/ =404;
}
var/www/example/index.html
是現有目錄中顯示文字。
當我平安從我個人的機器在AWS接口提供的公網IP,我得到迴應。
但是,當我從實例中運行curl -v localhost
,我得到
* Rebuilt URL to: localhost/
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* connect to 127.0.0.1 port 80 failed: Connection refused
* Failed to connect to localhost port 80: Connection refused
* Closing connection 0
curl: (7) Failed to connect to localhost port 80: Connection refused
此外,當我修改我的主機文件像這樣
my.public.ip local.example.com
連接超時。
當我編輯我的hosts
文件時,爲什麼我不能將我的index.html
服務到我的虛擬域?
一些AWS實例在幾分鐘前也停止工作,amazon.com,netflix.com和skype似乎也無法使用。目前這些網站是否適合您? – chris544
是的,amazon.com和netflix.com正在爲我工作。 – Himmel
好的,AWS和上面提到的網站現在可以爲我工作(但我確定他們已經停工了大約10分鐘)。這是在歐洲,所以也許這些問題是不相關的。 – chris544