Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Joomla search and nginx not working together

$
0
0
Hey guys,

Hoping somebody can help me out with a problem that has me scratching my head for two days. I've re-create my apache website on a different server using nginx+php-fpm+mysql. It is a joomla 1.5.26 website. I have almost eveything working and the only thing left is the search functionality.

Lets say that my website is called food.com and I am on my homepage. If i type in the word "food" into the joomla search, my address bar changes to http://www.food.com/search.html?ordering=&searchphrase=all&searchword=food. No problem, the search works great from my homepage.

Now let's say that I am reading an article at http://www.food.com/breads/goodbreads.html and I type in the word food into the joomla search. The address bar changes to http://www.food.com/breads/index.php and I get a "404 not found" error.

If I do the same thing on my apache website, the address bar always changes to http://www.food.com/search.html?ordering=&searchphrase=all&searchword=food - no matter where i am in the site.

I know why I get the error - because nginx is requesting index.php from food.com/breads/. Obviously since its a CMS that directory does not exist. My problem is that I don't know why it requesting index.php. I don't know why it works from the homepage and not anywhere else. I'm pretty sure I need some url rewriting but I don't know where to start.

Any help is appreciated. Below is my nginx config.

server {
listen 80;
listen 443 ssl;
server_name xyz;
access_log /srv/www/www.xyz.com/logs/access.log;
error_log /srv/www/www.xyz.com/logs/error.log info;
root /srv/www/www.xyz.com/public_html;
index index.html search.html index.php;

location /administrator {
allow xxx.xxx.xxx.xxx;
deny all;
}

location / {
expires 1d;
# Enable joomla SEF URL's inside Nginx
try_files $uri $uri/ /index.php?$args;
}

# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|gz)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

}

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>