Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    nginx help needed: cannot display a web 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):

    #user  nobody;
    worker_processes  1;
    #error_log  logs/error.log;
    #error_log  logs/error.log  notice;
    #error_log  logs/error.log  info;
    #pid        logs/;
    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
            #location ~ \.php$ {
            #    proxy_pass   ://;
            # pass the PHP scripts to FastCGI server listening on
            location ~ \.php$ {
                root           html;
                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

    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;

  2. #2
    Quick update before I head home for the day...

    I got a little bit a progress and I am able to get a 403 page now. I noticed in my nginx.conf i had user set to no one so the beginning of nginx.conf now reads "user nginx;".

    Even after changing the user to nginx, i am still getting forbidden. I have two errors showing in /usr/share/nginx/html/error.log and they are as follows:

    2011/12/16 16:15:16 [error] 15464#0: *15 FastCGI sent in stderr: "PHP Parse error: syntax error, unexpected ':' in /usr/share/nginx/html/index.php on line 2" while reading response header from upstream, client: x.x.x.x, server: james.***.com, request: "GET / HTTP/1.1", upstream: "fastcgi://", host: "james.***.com"

    and the second one is...

    2011/12/16 16:19:34 [error] 15521#0: *4 directory index of "/var/www/sites/" is forbidden, client: x.x.x.x, server: james.***.com, request: "GET / HTTP/1.1", host: "james.***.com"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts