Wednesday, June 12, 2013

Nginx Joomla ReWrite

If you get funny URLs such as “http://www.mysite.com/index.php/foo”, try turning on “Use mod_rewrite rules” in your Joomla settings.


server {

listen 80;

server_name mysite.com www.mysite.com;


access_log /var/log/nginx/mysite.com-access.log;

error_log /var/log/nginx/mysite.com-error.log;


large_client_header_buffers 4 8k; # prevent some 400 errors


root /var/www/mysite.com/html;

index index.php;


location / {

expires 30d;

error_page 404 = @joomla;

log_not_found off;

}


location @joomla {

rewrite ^(.*)$ /index.php?q=$1 last;

}


location ~ \.php$ {

fastcgi_pass 127.0.0.1:8888;

fastcgi_index index.php;

include /etc/nginx/fastcgi_params;

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

}

}



Nginx Joomla ReWrite

No comments:

Post a Comment