nginx vs clean url's

Webfoundry

Verified User
Joined
May 23, 2014
Messages
51
Location
Leuven, Belgium
Hi all,

I'm trying to implement this code to support clean (aka Search Engine Friendly) URLs for ALL sites in the server by following next tutorial for Joomla! : http://docs.joomla.org/Nginx

Code:
location / {
   try_files $uri $uri/ /index.php?$args;
}

This doesn't seem to work as it looks like DA uses /home as homedirectory for sites, while nginx.conf refers to /var/www/html as root

Code:
server {
        listen       xxx.xxx.xxx.xxx:80;
        server_name  $hostname xxx.xxx.xxx.xxx;
        [B]root   /var/www/html;[/B]
        index  index.html index.htm index.php;

        location / {
                access_log off;
                proxy_pass http://127.0.0.1:8080;
                proxy_set_header X-Client-IP      $remote_addr;
                proxy_set_header X-Accel-Internal /nginx_static_files;
                proxy_set_header Host             $host;
                proxy_set_header X-Forwarded-For  $proxy_add_x_forwarded_for;
                [B][I]try_files $uri $uri/ /index.php?$args; --> does not work[/I][/B]
        }


        location /nginx_static_files/ {
                access_log  /var/log/nginx/access_log_proxy;
                alias       /var/www/html/;
                internal;
        }
    }

Is there a fix to get clean URL's to work ?



Is it perhaps also due to this "wrong" root location that next code in /usr/local/directadmin/data/users/admin/nginx.conf my .htaccess files don't get denied as they should ?

Code:
# deny access to apache .htaccess files
        location ~ /\.ht
        {
                deny all;
        }


Thanks for all your support and kind help.
Sixten
 
Oh ok, I had the idea that this file only had influence on apache, not nginx.
That makes me even more puzzled why mod_rewrite does not work.

RewriteEngine on

But when (in Joomla!) I enable URL rewriting, only the frontpage of the site works. So something goes bad.

http://178.79.130.161/~xpandr/
http://178.79.130.161/~xpandr/contacts


P.S. : as I thought it was an nginx-apache CustomBuild 2.0 issue I posted in this forum.
 
When I use this testingsite (plain out-of-the-box Joomla) :

without .htaccess :
404 Not Found
The requested URL /~xpandr/contacts was not found on this server.

with .htaccess :
404 Not Found
The requested URL /home/xpandr/public_html/index.php was not found on this server.
 
Can anyone perhaps help me with how I can get an nginx rewrite command to work for all domains ?
It's the last thing that is keeping me from getting my server into production. All help welcomed :)

try_files $uri $uri/ /index.php?$args;
 
There might be another nginx template file in /usr/local/directadmin/data/templates the other ones are probably for apache only. If there is just copy it to the custom folder and edit it to your liking, then run:

Code:
echo "action=rewrite&value=httpd" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d30
 
For NGINX that should be:

Code:
echo "action=rewrite&value=nginx" >> /usr/local/directadmin/data/task.queue
/usr/local/directadmin/dataskq d
/etc/init.d/nginx restart
 
Back
Top