2016-05-27 4 views
1

Fedoraにnginxをインストールしました。しかし、なぜ私はブラウザを介してサーバのIPを要求して、デフォルトのnginxページを取得できないのかわかりません。私の要求はタイムアウトでダウンしています。NGINX Amazon EC2インスタンスのデフォルトページを表示しない

しかし、nginxが実行されています。

$ sudo service nginx status 
nginx (pid 20372) is running... 

私のデフォルトは設定は、私は何が起こっているか見当がつかない

# For more information on configuration, see: 
# * Official English Documentation: http://nginx.org/en/docs/ 
# * Official Russian Documentation: http://nginx.org/ru/docs/ 

user nginx; 
worker_processes auto; 
error_log /var/log/nginx/error.log; 
pid /var/run/nginx.pid; 

events { 
    worker_connections 1024; 
} 

http { 
    log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 
         '$status $body_bytes_sent "$http_referer" ' 
         '"$http_user_agent" "$http_x_forwarded_for"'; 

    access_log /var/log/nginx/access.log main; 

    sendfile   on; 
    tcp_nopush   on; 
    tcp_nodelay   on; 
    keepalive_timeout 65; 
    types_hash_max_size 2048; 

    include    /etc/nginx/mime.types; 
    default_type  application/octet-stream; 

    # Load modular configuration files from the /etc/nginx/conf.d directory. 
    # See http://nginx.org/en/docs/ngx_core_module.html#include 
    # for more information. 
    include /etc/nginx/conf.d/*.conf; 

    index index.html index.htm; 

    server { 
     listen  80 default_server; 
     listen  [::]:80 default_server; 
     server_name localhost; 
     root   /usr/share/nginx/html; 

     # Load configuration files for the default server block. 
     include /etc/nginx/default.d/*.conf; 

     location/{ 
     } 

     # redirect server error pages to the static page /40x.html 
     # 
     error_page 404 /404.html; 
      location = /40x.html { 
     } 

     # redirect server error pages to the static page /50x.html 
     # 
     error_page 500 502 503 504 /50x.html; 
      location = /50x.html { 
     } 

     # proxy the PHP scripts to Apache listening on 127.0.0.1:80 
     # 
     #location ~ \.php$ { 
     # proxy_pass http://127.0.0.1; 
     #} 

     # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 
     # 
     #location ~ \.php$ { 
     # root   html; 
     # fastcgi_pass 127.0.0.1:9000; 
     # fastcgi_index index.php; 
     # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 
     # include  fastcgi_params; 
     #} 

     # deny access to .htaccess files, if Apache's document root 
     # concurs with nginx's one 
     # 
     #location ~ /\.ht { 
     # deny all; 
     #} 
    } 

# Settings for a TLS enabled server. 
# 
# server { 
#  listen  443 ssl; 
#  listen  [::]:443 ssl; 
#  server_name localhost; 
#  root   /usr/share/nginx/html; 
# 
#  ssl_certificate "/etc/pki/nginx/server.crt"; 
#  ssl_certificate_key "/etc/pki/nginx/private/server.key"; 
#  # It is *strongly* recommended to generate unique DH parameters 
#  # Generate them with: openssl dhparam -out /etc/pki/nginx/dhparams.pem 2048 
#  #ssl_dhparam "/etc/pki/nginx/dhparams.pem"; 
#  ssl_session_cache shared:SSL:1m; 
#  ssl_session_timeout 10m; 
#  ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 
#  ssl_ciphers HIGH:SEED:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!RSAPSK:!aDH:!aECDH:!EDH-DSS-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA:!SRP; 
#  ssl_prefer_server_ciphers on; 
# 
#  # Load configuration files for the default server block. 
#  include /etc/nginx/default.d/*.conf; 
# 
#  location/{ 
#  } 
# 
#  error_page 404 /404.html; 
#   location = /40x.html { 
#  } 
# 
#  error_page 500 502 503 504 /50x.html; 
#   location = /50x.html { 
#  } 
# } 

} 

で生成されました。 /var/log/nginx/access.logおよび/var/log/nginx/access.logも空です。助けてください...

+1

サーバーの場所によっては、アクセスするためにファイアウォールを調整する必要があります。サーバーには独自のファイアウォールがあります。それがクラウド(AWS)にある場合は、ローカルIPからアクセスするためのアクセス許可を付与する必要があります。オフィス環境にいる場合、会社は特定のipsへのアクセスを許可しないことがあります。 – xxfelixxx

+0

あなたはhosterを意味しますか? Amazon EC2です。私に何ができる? –

+1

サーバーがセキュリティグループに属しています。 EC2 Webコンソールに移動し、インスタンスを見つけます。そのセキュリティグループをクリックします。 Inboundをクリックします。編集をクリックします。 Add Rule - > HTTPを選択し、SourceフィールドをMy Ipに設定します。 – xxfelixxx

答えて

3

Amazon EC2では、ブラウザからインスタンスへの着信HTTP接続を許可するためにファイアウォールを開く必要があります。 EC2へ

  1. のAmazon Webコンソールにログイン
  2. Goは
  3. そのセキュリティグループにインスタンス
  4. をクリックして下さい
  5. インバウンド]タブをクリックします
  6. は、ルールの追加、編集
  7. をクリックします - >HTTPには、ソースフィールドをMy Ip
に設定します

変更はすぐに有効になります。

固定IP以外の場所(コーヒーショップのWi-Fi)からインスタンスにアクセスする場合は、接続するたびにソースIPアドレスを変更して新しいIPアドレスを割り当てる必要があります。だからそれがうまくいくとしばらくしてから、それがハングアップしているように見えるかもしれません。

HTTPSも提供している場合は、特定のルールも追加します。

関連する問題