Clean URLs not working after migration to new LEMP server (other sites, clean URLs work fine)

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

I migrated via a mysqldump and a tarball a Drupal 7 site from one LAMP server to our LEMP server. I realized Clean URLs does not work, despite clean URLs working on another site (the vhost config is copied from said site). I have a very simple vhost config that calls 'include template;' which has all the good stuff in it, including the rewrite rules for Drupal 7.

I came across something on the nginx wiki (q.v. http://wiki.nginx.org/Drupal under "Notes") that says if you use Drupal in a subdirectory, it needs additional rewrites, and I tried the code, with no success.

My site is located in /var/www/www.example1.com/www/northamerica/* so it indeed in a subdirectory (other site's root is /var/www/www.example2.com/www/*). I cannot move the root of example1.com like example2.com because we have a simple html page that appears before the "northamerica" folder in www that points to our Drupal app.

Is this the issue? Can someone shed some light? Thank you. (configs below)

vhost for example1.com

server {
        listen 80;
        server_name www.example1.com;

location / {
        root /var/www/www.example1.com/www/;
        index index.php;
        include template;
        #setup logging
        access_log /var/www/www.example1.com/logs/access.log;
        error_log /var/www/www.example1.com/logs/error.log;
        try_files $uri $uri/ /index.php?q=$uri;
        }
}

template config

#Drupal specific rewriting configuration
    location / {
        try_files $uri $uri/ /index.php?q=$uri&$args;
    }

# pass php requests to php-fpm
    location ~ .php$ {

# Connect via socket not TCP
#fastcgi_pass unix:/var/run/php-fpm/phpsock.sock;

        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_intercept_errors on; # display errors use only for testing
#Include params from /etc/nginx/fastcgi_param
        include fastcgi_params;
        fastcgi_ignore_client_abort     off;
    }
#Do not allow to view  .htaccess and .htpassword
    location ~ /.ht {
        deny  all;
    }

nginx.conf

user  www-data;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}

http {
    #performance tweaks
    client_max_body_size 60M;
    client_body_buffer_size 128k;
    # end performance tweaks

    include       /etc/nginx/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  /var/log/nginx/access.log  main;

    ##
    # Basic Settings
    ##
    sendfile       on;
    tcp_nopush     on;
    tcp_nodelay    on;
    keepalive_timeout  65;

   types_hash_max_size 2048;
    server_tokens off; # hide server info on errors
#    include /etc/nginx/mime.types;
#    default_type application/octet-stream;

    ##
    # gzip settings
    ##
    gzip  on;
    gzip_disable "msie6";
    gzip_min_length 1100;
    gzip_vary on;
    gzip_proxied any;
    gzip_comp_level 4;

    gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/$

    ##
    # Virtual Hosts Configs
    ##
    include /etc/nginx/conf.d/.conf;
    include /etc/nginx/sites-enabled/
;
}

Comments

are you sure about the

rajibmp's picture

are you sure about the vhost's root location ?

does error log say something ?

Nginx

Group organizers

Group notifications

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