XF 1.4 Friendly URLs

SoManyPosts

Active member
I'm trying to get the friendly URLs working on my website but the pages keep going to 404.

Here's the config if anyone wouldn't mind helping. Don't I just paste this at the end of my nginx file?

Code:
server {
    listen   [::]:80;
    server_name  www.domain.com domain.com;
    root   /usr/share/nginx/html;
    index  index.html index.htm index.php;
    access_log  /usr/share/nginx/html/domain.com.access.log; 

    location / {
        try_files            $uri $uri/ /index.php?$uri&$args;
    }
   
    location /data/ {
        allow                127.0.0.1;
        deny                all;
    }
   
    location /internal_data/ {
        allow                127.0.0.1;
        deny                all;
    }
   
    location /library/ {
        allow                127.0.0.1;
        deny                all;
    }
    location ~ \.php$ {
        fastcgi_index            index.php;
        fastcgi_pass            127.0.0.1:9000;
        include                fastcgi.conf;
        fastcgi_intercept_errors    on;
        fastcgi_ignore_client_abort    on;
    }

}
 
I'm trying to get the friendly URLs working on my website but the pages keep going to 404.
Here's the config if anyone wouldn't mind helping. Don't I just paste this at the end of my nginx file?


Let me guess... nginx and you are using cut/paste to configure it?

What OS are you using?
 
That is not what I meant,
Code:
    location ~ \.php$ {
        root /var/www/html/domain.com
        fastcgi_index            index.php;
        fastcgi_pass            127.0.0.1:9000;
        include                fastcgi.conf;
        fastcgi_intercept_errors    on;
        fastcgi_ignore_client_abort    on;
    }
}
That should be the location where your files are located, like /var/www/html/domain.com/public/ If you're comfortable in giving me access I can fix it for you.
 
So your config should be:
Code:
server {
    listen       80;
    server_name  www.domain.com;

    charset utf-8;
    access_log  /usr/share/nginx/html/domain.com.access.log;

    location / {
        root           /usr/share/nginx/html/;
        index index.php;
        try_files $uri $uri/ /index.php?$uri&$args;
    }
  
    location /internal_data/
    {
        root           /usr/share/nginx/html/;
        internal;
        allow 127.0.0.1;
        deny all;
    }

    location /library/
    {
        root           /usr/share/nginx/html/;
        internal;
        allow 127.0.0.1;
        deny all;
    }

    location ~ \.php$ {
        root           /usr/share/nginx/html/;
        try_files $uri =404;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }
}

Why haven't you created vhost yet? if its for a live site then do so.
 
Yeah I should have done that @Tracy Perry but I even tried the default setup and I still can't get it working. If my install is in the web root, shouldn't this work?

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

location /internal_data/ {
    internal;
}
location /library/ {
       internal;
}

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass    127.0.0.1:9000;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include         fastcgi_params;
}
 
Code:
    location / {
## Deny certain User-Agents (case insensitive)
     ## The ~* makes it case insensitive as opposed to just a ~
     if ($http_user_agent ~* (AHrefs|Baidu|Morfeus|ZmEu|Baiduspider|Jullo|Yandex|Sogou|Baidu) ) {
        return 444;
     }
   
            try_files $uri $uri/ /index.php?$uri&$args;
            index index.php index.html index.htm;

location ~ \.php$ {
   try_files $uri =404;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   include fastcgi_params;
   fastcgi_index index.php;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

In a nutshell for my base... but you have to have the fastcgi_params also configured.
 
Code:
    location / {
## Deny certain User-Agents (case insensitive)
     ## The ~* makes it case insensitive as opposed to just a ~
     if ($http_user_agent ~* (AHrefs|Baidu|Morfeus|ZmEu|Baiduspider|Jullo|Yandex|Sogou|Baidu) ) {
        return 444;
     }
  
            try_files $uri $uri/ /index.php?$uri&$args;
            index index.php index.html index.htm;

location ~ \.php$ {
   try_files $uri =404;
   fastcgi_split_path_info ^(.+\.php)(/.+)$;
   include fastcgi_params;
   fastcgi_index index.php;
   fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        }

In a nutshell for my base... but you have to have the fastcgi_params also configured.
I used the default one provided by XenForo – any idea why that wouldn't work though? I kept getting a [failed] to restart when I pasted it in the bottom of the config, where I assume it should be pasted ...
 
Back
Top Bottom