Friday 16 December 2011

Help with nginx! Cannot display anything beside default page

Help with nginx! Cannot display anything beside default page

Please go easy on me, I have only been using Linux for a week and this is my first attempt at setting up a nginx server. As such, everything you see below will no doubt be very messy :(

Just a little bit of quick info about the issue.
- DNS entries are correct and I am able to ping the server by IP and web address fine.
- The default web page for nginx displays correctly via IP in web browser (via local host or another computer on my network), but as soon as I plug in the DNS name, I get a time out displaying a web page
- !!! I have read and looked through countless guides, and I have a feeling they have overlapped in to my conf files causing problems.


Now I have literally 0 idea what the issue is. From what I understand, if it is a problem with PHP I should receive a error on the site saying something. As I am not even displaying the site, I have to assume it is something with the conf files.

"You are only allowed to post URLs to other sites after you have made 15 posts or more." Anything in the conf files that have a extra space in a url is because I had to make them not url's


I have stored my sites index.php in /var/www/sites/james/index.php. Im sure this isnt the ideal location, but again I am new.

Here is /etc/nginx/nginx.conf (messy I know! I took the default and just added to it without removing anything yet):

Code:

#user  nobody;
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;
    index index.html index.htm index.php;

    #access_log  logs/access.log  main;

    #sendfile        on;
    #tcp_nopush    on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen      80;
        server_name  james.***. com;
        root    /var/www/sites/james;
                #index  index.php;
                #access_log  logs/host.access.log  main;
        location / {

        }

        #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 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass  ://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$php_cgi;
            fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
            #fastcgi_param  SCRIPT_FILENAME  /etc/init.d/php_cgi.php
            include        fastcgi.conf;
        }

        # 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  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers  on;

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

Here is my /etc/nginx/conf.d/virtual.conf

Code:

http {
  index index.php;
  listen        80;

  server {
    listen      james.***. com:80;
    server_name james.***. com;
    #access_log logs/domain1.access.log main;

    root /var/www/sites/james;
  }

}

No comments:

Post a Comment