How to get nginx to serve up on an elastic IP
        Posted  
        
            by 
                geekbri
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by geekbri
        
        
        
        Published on 2011-02-02T05:39:07Z
        Indexed on 
            2011/02/02
            7:27 UTC
        
        
        Read the original article
        Hit count: 678
        
I have an EC2 instance which is serving up PHP pages with nginx and php-fpm. This works perfectly fine when accessed through the public DNS for the instance. However if I try to access the site with the Elastic IP which is bound to it, it serves up a generic "Welcome to nginx" page, even though in my server block i have listen 80 (which i thought listened on all incoming IPs on port 80).
Here is my nginx config.
server {
listen 80;
access_log  /var/log/nginx/access.log;
root   "/var/www/clipperz/";
index  index.html index.php;
# Default location
location / {
    try_files $uri $uri/ index.html;
}
# Parse all .php file in the $document_root directory
location ~ .php$ {
    include fastcgi_params;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
}
}
© Server Fault or respective owner