Nginx showing default page instead of installed Drupal page

Events happening in the community are now at Drupal community events on www.drupal.org.
fehin's picture

I used Perusio's setup and Nginx and php5-fpm are running without errors. My root files are located at srv/www. I indicated this in the config and enabled the sites with
ln -s /etc/nginx/sites-available/website1.com /etc/nginx/sites-enabled/website1.com.

I don't know what I'm missing.

Comments

Are you

perusio's picture

sure you have properly configured the listen and root directives.

As I was setting up the

fehin's picture

As I was setting up the configuration I got this error "unknown directive "set_real_ip_from" in /etc/nginx/nginx.conf:32" so I upgraded to the latest Nginx version and the message went away. Then I opened my webpage and it took me to the default Nginx page. I did a "/etc/init.d/nginx stop" and "/etc/init.d/nginx restart" today and the message is back. So I think the issue may be "set_real_ip_from".

My current Nginx version is 1.2.7.

can you post your vhost

likewhoa's picture

can you post your vhost config? i dont think set_real_ip_from is your issue.

bending technology to fit businesses.

My vhost is below. Thanks! #

fehin's picture

My vhost is below. Thanks!

# -- mode: nginx; mode: flyspell-prog;  ispell-current-dictionary: american --
### Configuration for grchef.com.

## Return (no rewrite) server block.
server {
    ## This is to avoid the spurious if for sub-domain name
    ## "rewriting".
    listen 80; # IPv4
    ## Replace the IPv6 address by your own address. The address below
    ## was stolen from the wikipedia page on IPv6.
    # listen [fe80::202:b3ff:fe1e:8329]:80 ipv6only=on;
    server_name www.grchef.com;
    return 301 $scheme://grchef.com$request_uri;

} # server domain return.

## HTTP server.
server {
    listen 80; # IPv4
    ## Replace the IPv6 address by your own address. The address below
    ## was stolen from the wikipedia page on IPv6.
    # listen [fe80::202:b3ff:fe1e:8329]:80 ipv6only=on;

    server_name grchef.com;
    limit_conn arbeit 32;

    ## Access and error logs.
    access_log /var/log/nginx/grchef.com_access.log;
    error_log /var/log/nginx/grchef.com_error.log;

    include global/webmail.conf;
   
    ## See the blacklist.conf file at the parent dir: /etc/nginx.
    ## Deny access based on the User-Agent header.
    if ($bad_bot) {
        return 444;
    }
    ## Deny access based on the Referer header.
    if ($bad_referer) {
        return 444;
    }

    ## Protection against illegal HTTP methods. Out of the box only HEAD,
    ## GET and POST are allowed.
    if ($not_allowed_method) {
        return 405;
    }

    ## Filesystem root of the site and index.
    root /srv/www/grchef.com/public_html;
    index index.php;

    ## If you're using a Nginx version greater or equal to 1.1.4 then
    ## you can use keep alive connections to the upstream be it
    ## FastCGI or Apache. If that's not the case comment out the line below.
    fastcgi_keep_conn on; # keep alive to the FCGI upstream

    ## Uncomment if you're proxying to Apache for handling PHP.
    #proxy_http_version 1.1; # keep alive to the Apache upstream

    ################################################################
    ### Generic configuration: for most Drupal 7 sites.
    ################################################################
    include apps/drupal/drupal.conf;

    ################################################################
    ### Generic configuration: for most Drupal 6 sites.
    ################################################################
    # include apps/drupal/drupal6.conf;

    #################################################################
    ### Configuration for Drupal 7 sites that use boost.
    #################################################################
    #include apps/drupal/drupal_boost.conf;

    #################################################################
    ### Configuration for Drupal 6 sites that use boost.
    #################################################################
    #include apps/drupal/drupal_boost6.conf;

    #################################################################
    ### Configuration for updating the site via update.php and running
    ### cron externally. If you don't use drush for running cron use
    ### the configuration below.
    #################################################################
    include apps/drupal/drupal_cron_update.conf;

    #################################################################
    ### Support for upload progress bar. Configurations differ for
    ### Drupal 6 and Drupal 7.
    #################################################################

    ## This is for Drupal 7. Comment out the line below if you're on
    ## Drupal 6.
    include apps/drupal/drupal_upload_progress.conf;

    ## This is for Drupal 6. Comment out the line above and uncomment
    ## the line below if you're on Drupla 6.
    #include apps/drupal/drupal6_upload_progress.conf;

    ## Including the php-fpm status and ping pages config.
    ## Uncomment to enable if you're running php-fpm.
    include php_fpm_status_vhost.conf;

    ## Including the Nginx stub status page for having stats about
    ## Nginx activity: http://wiki.nginx.org/HttpStubStatusModule.
    include nginx_status_vhost.conf;

} # HTTP server


## Return (no rewrite) server block.
server {
    ## This is to avoid the spurious if for sub-domain name
    ## "rewriting".
    listen 443; # IPv4
    ## Replace the IPv6 address by your own address. The address below
    ## was stolen from the wikipedia page on IPv6.
    # listen [fe80::202:b3ff:fe1e:8329]:443 ipv6only=on;
    server_name www.grchef.com;

    ## Keep alive timeout set to a greater value for SSL/TLS.
    keepalive_timeout 75 75;

    ## See the keepalive_timeout directive in nginx.conf.
    ## Server certificate and key.
    ## ssl_certificate /etc/ssl/certs/example-cert.pem;
    ## ssl_certificate_key /etc/ssl/private/example.key;

    return 301 $scheme://grchef.com$request_uri;

} # server domain return.

## HTTPS server.
server {
    listen 443 ssl;
    ## Replace the IPv6 address by your own address. The address below
    ## was stolen from the wikipedia page on IPv6.
    # listen [fe80::202:b3ff:fe1e:8329]:443 ssl ipv6only=on;

    server_name grchef.com;
    limit_conn arbeit 32;

    ## Access and error logs.
    access_log /var/log/nginx/grchef.com_access.log;
    error_log /var/log/nginx/grchef.com_error.log;

    ## Keep alive timeout set to a greater value for SSL/TLS.
    keepalive_timeout 75 75;

    ## See the keepalive_timeout directive in nginx.conf.
    ## Server certificate and key.
    ## ssl_certificate /etc/ssl/certs/example-cert.pem;
    ## ssl_certificate_key /etc/ssl/private/example.key;

    ## Strict Transport Security header for enhanced security. See
    ## http://www.chromium.org/sts. I've set it to 2 hours; set it to
    ## whichever age you want.
    add_header Strict-Transport-Security "max-age=7200";

    root /srv/www/grchef.com/public_html;
    index index.php;

    ## If you're using a Nginx version greater or equal to 1.1.4 then
    ## you can use keep alive connections to the upstream be it
    ## FastCGI or Apache. If that's not the case comment out the line below.
    fastcgi_keep_conn on; # keep alive to the FCGI upstream

    ## Uncomment if you're proxying to Apache for handling PHP.
    #proxy_http_version 1.1; # keep alive to the Apache upstream

    ## See the blacklist.conf file at the parent dir: /etc/nginx.
    ## Deny access based on the User-Agent header.
    if ($bad_bot) {
        return 444;
    }
    ## Deny access based on the Referer header.
    if ($bad_referer) {
        return 444;
    }

    ## Protection against illegal HTTP methods. Out of the box only HEAD,
    ## GET and POST are allowed.
    if ($not_allowed_method) {
        return 405;
    }

    ################################################################
    ### Generic configuration: for most Drupal 7 sites.
    ################################################################
    include apps/drupal/drupal.conf;

    ################################################################
    ### Generic configuration: for most Drupal 6 sites.
    ################################################################
    # include apps/drupal/drupal6.conf;

    #################################################################
    ### Configuration for Drupal 7 sites that use boost.
    #################################################################
    #include apps/drupal/drupal_boost.conf;

    #################################################################
    ### Configuration for Drupal 6 sites that use boost.
    #################################################################
    #include apps/drupal/drupal_boost6.conf;

    ################################################################
    ### Installation handling. This should be commented out after
    ### installation if on an already installed site there's no need
    ### to touch it. If on a yet to be installed site. Uncomment the
    ### line below and comment out after installation. Note that
    ### there's a basic auth in front as secondary ligne of defense.
    ################################################################
    #include apps/drupal/drupal_install.conf;

    #################################################################
    ### Configuration for updating the site via update.php and running
    ### cron externally. If you don't use drush for running cron use
    ### the configuration below.
    #################################################################
    include apps/drupal/drupal_cron_update.conf;

    #################################################################
    ### Support for upload progress bar. Configurations differ for
    ### Drupal 6 and Drupal 7.
    #################################################################

    ## This is for Drupal 7. Comment out the line below if you're on
    ## Drupal 6.
    include apps/drupal/drupal_upload_progress.conf;

    ## This is for Drupal 6. Comment out the line above and uncomment
    ## the line below if you're on Drupla 6.
    #include apps/drupal/drupal6_upload_progress.conf;

    ## Including the php-fpm status and ping pages config.
    ## Uncomment to enable if you're running php-fpm.
    include php_fpm_status_vhost.conf;

    ## Including the Nginx stub status page for having stats about
    ## Nginx activity: http://wiki.nginx.org/HttpStubStatusModule.
    include nginx_status_vhost.conf;

} # HTTPS server

Is the grchef.com domain

perusio's picture

declared in your /etc/hosts or in a DNS entry somewhere? I suspect you're getting the default server instead of the site. What does: ls -la /etc/nginx/sites-enabled gives?

I used the command and all my

fehin's picture

I used the command and all my enabled sites are listed. Since I did a stop and restart, I only get "Unable to connect" message in Firefox, I no longer get the default page. I'm unable to restart Nginx. The errorlog only shows unknown directive "set_real_ip_from" in /etc/nginx/nginx.conf:32

Yeah I should add a notice on the readme

perusio's picture

about the real ip module. Comment out that line: add a # to the beginning of the line and retry.

Nginx

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: