• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Setup SEO Full Friendly URLs on nginx

Alright, I think I have everything working now. The main things changed were the following:

Code:
##what do we do with php files
    location ~ \.php$ {
        include fastcgi_params;
        include fastcgi_config;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
}

I've no idea why, but using $document_root in the fastcgi_config file I mentioned earlier did not work. I got all white pages. Putting it in the above location that specifies php files being accessed fixed this.

I then did:

Code:
location /xf/ {
        try_files $uri $uri/ /xf/index.php;
        index index.php;

}

If I omit the 'index index.php;' part, I get a white page when visiting the mydomain.net/xf/ page. The 'index.php?$uri&$args;' mentioned earlier also works, but the first is shorter and I get the same results.

edit:

I also defined the document root in:

Code:
server {
    listen 80;
    server_name mydomain.net;
    access_log /var/log/nginx/mydomain.access.log;

    root /home/mydomain/www;

instead of the location sections.
 
(In general response to IfIsEvil) There is nothing wrong with using if (my config uses over 50 of them) - you just have to know when it's not appropriate to use and what commands are safe inside it.

And I don't imagine performance will be much different unless the ifs are checking existence of files, which is the perfect time for try_files.
 
(In general response to IfIsEvil) There is nothing wrong with using if (my config uses over 50 of them) - you just have to know when it's not appropriate to use and what commands are safe inside it.

And I don't imagine performance will be much different unless the ifs are checking existence of files, which is the perfect time for try_files.

I honestly didn't notice any performance lapses with if block. but admittedly my board is not that large :D so I don't know.
In theory for rewrite rules the if block is a big no no :D use try_files instead
 
Actually, after further inspection, it does appear important to have the following extra at the end of index.php:

Code:
try_files $uri $uri/ /xf/index.php?$uri&$args;

Instead of the base

Code:
try_files $uri $uri/ /xf/index.php;

Profile window popups do not work without it.
 
So to not hijack this thread, what your software does? if you can start a new thread.
I clicked on yesterday, didn't spend much time though. but I'd like to hear it from the horse's mouth :D
 
I have some nginx materials for you. Saves me lots of headaches every time ;)
Related to nginx config? I've been working with it since it become public.
I build my own RPM's optimized for performance, as well the config files.
 
Related to nginx config? I've been working with it since it become public.
I build my own RPM's optimized for performance, as well the config files.

New changes with every update. any way it's the new reference manual ;)
 
Top Bottom