title: Joomla with Nginx Rewrite SEF url
body: <p>I am using Ubuntu 12.04 with NGINX and PHP5-FPM. I've just migrated my Joomla website from Apache to NGINX. But i think rewrite rules are not working well.</p>
  
  <p>All of the SEF links rewrite to the homepage, but in the url bar link seems right.</p>
  
  <p>Example if i click example.com/a/b.html it looks like go to the link in the url bar but homapage is loading.</p>
  
  <p>Thanks for your help.</p>
  
  <p>/etc/nginx/sites-available/example.com file </p>
  
  <pre><code>server {
      listen 80;
      server_name example.com;
      #server_name_in_redirect off;
  
      #access_log /var/log/nginx/localhost.access_log main;
      #error_log /var/log/nginx/localhost.error_log info;
  
      root /var/www/example.com/public_html/;
      index index.php index.html index.htm default.html default.htm;
      # Support Clean (aka Search Engine Friendly) URLs
      location / {
              try_files $uri $uri/ /index.php?q=$request_uri;
      }
  
      # deny running scripts inside writable directories
      location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
              return 403;
              error_page 403 /403_error.html;
      }
  
      location ~ \.php$ {
              # With php5-fpm:
              fastcgi_pass unix:/var/run/php5-fpm.sock;
              include fastcgi_params;
              #fastcgi_index index.php;
              fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
              }
  
      # caching of files 
      location ~* \.(ico|pdf|flv)$ {
              expires 1y;
      }
  
      location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
              expires 14d;
      }
  
   }
  </code></pre>
  
  <p>nginx.conf</p>
  
  <pre><code>user www-data;
  worker_processes 8;
  pid /var/run/nginx.pid;
  
  events {
  worker_connections 1024;
  # multi_accept on;
  }
  
  http {
  
  ##
  # Basic Settings
  ##
  
  sendfile on;
  tcp_nopush on;
  tcp_nodelay on;
  keepalive_timeout 30;
  types_hash_max_size 2048;
  server_tokens off;
  
  # server_names_hash_bucket_size 64;
  # server_name_in_redirect off;
  
  include /etc/nginx/mime.types;
  default_type application/octet-stream;
  
  ##
  # Logging Settings
  ##
  
  access_log /var/log/nginx/access.log;
  error_log /var/log/nginx/error.log;
  
  ##
  # Gzip Settings
  ##
  
  gzip on;
  gzip_disable "msie6";
  
  gzip_vary on;
  # gzip_proxied any;
  gzip_comp_level 6;
  # gzip_buffers 16 8k;
  gzip_http_version 1.1;
  gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
  
  ##
  # nginx-naxsi config
  ##
  # Uncomment it if you installed nginx-naxsi
  ##
  
  #include /etc/nginx/naxsi_core.rules;
  
  ##
  # nginx-passenger config
  ##
  # Uncomment it if you installed nginx-passenger
  ##
  
  #passenger_root /usr;
  #passenger_ruby /usr/bin/ruby;
  
  
      ## Block spammers and other unwanted visitors  ##
      include /etc/nginx/blockips.conf;
  
  ##
  # Virtual Host Configs
  ##
  
  include /etc/nginx/conf.d/*.conf;
  include /etc/nginx/sites-enabled/*;
     }
  </code></pre>