Php

帶有 NGINX 的 EC2 微

  • September 12, 2012

我有一個執行 Ubuntu 12.04 的 EC2 Micro。我已經為它分配了一個 EIP (23.21.213.236),並且我將我的域名 A 記錄指向了這個 IP。

我試圖訪問的域是 utoolsandfixings.co.uk,這應該會顯示一個頁面,上面寫著“找到伺服器”。

在我做出所有修改後,我嘗試重新啟動 NGINX。

我已經在伺服器上安裝了 NGINX 並設置了 VHost,設置了符號連結等。 VHOST 如下:

server {
   listen 80; ## listen for ipv4
   server_name utoolsandfixings.co.uk; ## change this to your own domain name
   # I find it really useful for each domain & subdomain to have its own error and access log
   error_log /var/log/nginx/utoolsandfixings.co.uk.error.log;
   access_log /var/log/nginx/utoolsandfixings.co.uk.access.log;
   location / {
           # Change this to the folder where you want to store your website
           root /var/www/utoolsandfixings.co.uk/;
           index index.html index.htm index.php;
   }
   # redirect server error pages to the static page /50x.html
   #
   error_page 500 502 503 504 /50x.html;
   location = /50x.html {
           root /var/www/nginx-default;
   }
   # We haven't setup FastCGI yet, but lets configure this now anyways
   #
   # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
   location ~ \.php$ {
           fastcgi_pass 127.0.0.1:9000;
           fastcgi_index index.php;
           # again, change the directory here to your website's root directory make sure to leave $fastcgi_script_name; on the end!
           fastcgi_param SCRIPT_FILENAME /home/meltingice_net/public_html$fastcgi_script_name;
           include /etc/nginx/fastcgi_params;
   }

}

還有我的 nginx.conf

user www-data;
worker_processes 4;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;

events {
   worker_connections 1024;
   # multi_accept on;
}
http {
   include /etc/nginx/mime.types;
   access_log /var/log/nginx/access.log;
   sendfile on;
   #tcp_nopush on; keepalive_timeout 0;
   keepalive_timeout 2;
   tcp_nodelay on;
   gzip on;
   gzip_disable msie6;
   include /etc/nginx/conf.d/*.conf;
   include /etc/nginx/sites-enabled/*;
}

任何幫助都將不勝感激。

NGINX 是否在實例上執行(啟動)?/etc/init.d/nginx status

懷疑這是防火牆問題,您是否為允許 HTTP 的實例分配了安全組?這裡有一個合理的指南。

此外,您是否檢查過實例上沒有本地防火牆丟棄傳入流量?sudo iptables --list

引用自:https://serverfault.com/questions/426722