Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm on Amazon Ec2, with an Arch Linux server. While I truly am loving it, I'm having the issue of actually getting nginx to display anything. Everytime I try to throw my hostname into the browser, the browser states that it's not available for some reason - almost as if the host doesn't even exist.

One thing I'd like to know is, how can I get this up and running? Is there a specific arch linux configuration I have to do to make it web accessible? I have port 80 open, as well as port 22. I've tried using gunicorn, python-flup, and nginx.

Nginx Config

user  http;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid        logs/nginx.pid;

events {
    worker_connections  1024;

http {
    include       mime.types;
    default_type  application/octet-stream;

    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  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

   server {

    listen      80;
    server_name _;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    #charset koi8-r;

    location ^~ /media/ {
        root /path/to/media;

    location ^~ /admin-media/ {
        root /usr/lib/python2.7/site-packages/django/contrib/admin/media;

    location / {

        root /path/to/root/;

        fastcgi_param SERVER_NAME $server_name;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_pass_header Authorization;
        fastcgi_intercept_errors off;
        fastcgi_index index.html;

        index index.htm index.html;

    error_page 500 502 503 504 /50x.html;

    location = /50x.html {
        root /etc/nginx/html/50x.html;


   # server {
   #     listen       80;
   #     server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

  #      location / {
   #         root   html;
    #        index  index.html index.htm;
     #   }

        #error_page  404              /404.html;

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

        # proxy the PHP scripts to Apache listening on
        #location ~ \.php$ {
        #    proxy_pass;

        # pass the PHP scripts to FastCGI server listening on
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass;
        #    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;

    # another virtual host using mix of IP-, name-, and port-based configuration
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }

    # HTTPS server
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }


I can't quite tell if it's a server issue or a configuration issue: I've followed so many guides now I can't even count them all. The thing is that Django itself is working fine, and my permissions to the document root of the where the site files are stored is 777. Ontop of that, I have a git repo which works perfectly fine, and django, python, and runfcgi all start without issues. The same goes for gunicorn, when I do a gunicorn_django -b in my document root.

Here is my output from that:

2012-04-15 05:17:37 [3124] [INFO] Starting gunicorn 0.14.2
2012-04-15 05:17:37 [3124] [INFO] Listening at: (3124)
2012-04-15 05:17:37 [3124] [INFO] Using worker: sync
2012-04-15 05:17:37 [3127] [INFO] Booting worker with pid: 3127

As far as I know, everything seems fine, as well as error.log and access.log for nginx. The access log is completely blank, for that matter.

I just feel lost here; what would be a step in the right direction to bebugging an issue such as this?

share|improve this question
a) Try the IP address instead of hostname (also do you mean the EC2 public DNS or a domain name?) b) verify the port is open (e.g. using nmap remotely) - you need to open it on both iptables (iptables -nvL to check) and the security group (ec2-describe-group) c) verify that nginx is listening on the correct address and port (using netstat -anp | grep nginx) d) try to fetch a (static) file from the instance itself using curl - all your tests should be static files (bypassing django/gunicorn) before you try dynamic to narrow the problem e) increase error_log verbosity to info or notice –  cyberx86 Apr 15 '12 at 6:15
I mean the ec2 domain name, but I just tried it with an elastic IP address and no dice either. Also, iptables appears to not giving me any output at all: do you have any idea what this means? –  Holland Apr 15 '12 at 6:33
iptables v1.4.12.2: can't initialize iptables table filter': Table does not exist (do you need to insmod?)` –  Holland Apr 15 '12 at 6:36
I got it working! Thank you, ec2-describe-group is what did it. –  Holland Apr 15 '12 at 6:41
Good to know you got it working - the security group was what I was leading towards. Post your solution and explanation as an answer and close out the question. –  cyberx86 Apr 15 '12 at 6:51
add comment

1 Answer

For some reason, I had thought that port 80 was open (as I remember enabling it before). The issue was simply that it was closed.

So, on the local machine, all I did was type

ec2-authorize default -p 80

Where -p is the port directive, and default is the name of the security group.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.