Introduce yourself here! In order to avoid spam, new users must first comment on the discussion in the 'Introductions' before they become 'full members'
Prettyurls question
  • hello,
    First, flatpress is flat out badass. Soooo fast with nginx/opcache. I'm easily hitting 1600-2000 req per second on a tiny vps server with fastcgi caching in a tmpfs. -its screaming fast, I love it.

    I searched these forums as well as the old forums. But the only mention of this I found was from 2008 so I figured I would ask here.

    My question is - is there any way to remove the date from the url.
    Eg: blabla.com/2015/02/10/my-page-name/
    To: blabla.com/my-page-name/

    I've cloned my server environment in a vm for local testing but thus far I've been unsuccessful in rewriting the prettyurls plugin.php.

    I can get it to make all links blabla.com/my-page-name/ but it seems like they're trying to redirect to a static page that doesn't exist.
  • Hi, you can't for the moment...
    You should change the cache system, which is divided by month...

    I'd like to know this: what fastcgi handler are you using? On my VPS I'm using FPM with nginx and it's very good too, but I'm not using opcache...
  • Would I need to rewrite the caching setup? Any tips? Url's without the date would be a huge huge help.

    fastcgi_cache creates a static page from the compiled output of a php page.. So when a visitor clicks on any page fastcgi cache makes a static version of it and sends that out from then on with no php calls.

    Its similar to those caching setups in wordpress. But tbh its a lot faster and all server sided. Plus you can store all the cached content in a tmpfs so everything is served out of ram with 0 disk IO's.

    My nginx/php5-fpm setup.
    nginx-1.7.10 -built from source.
    The latest php 5.6 built from source - minimal install/compile options.

    -> gzip_static module. no on the fly gzip in nginx
    gzip_static on;
    gzip off;

    -> make a 20MB tmpfs for the fastcgi_temp
    -> make a 20MB tmpfs for fastcgi_cache_path

    You can set the fastcgi_cache inactive and valid to what ever time you like. On a site that never changes you could run something like inactive inactive=48h "48 hours" and valid 52h; "52 hours" if you wanted to.

    I run mine at somewhat low time's because I add posts fairly frequently. But if you got slammed from reddit or something nginx+fastcgi_cache would serve all data as static and from ram.


    http {

    open_file_cache max=200 inactive=6m;
    open_file_cache_min_uses 1;
    open_file_cache_valid 10m;
    open_file_cache_errors on;

    fastcgi_temp_path /usr/local/some/folder/cache/fastcgi_temp 1 2;
    fastcgi_ignore_headers Cache-Control Expires Set-Cookie;

    fastcgi_cache_path /usr/local/some/folder/cache levels=1:2 keys_zone=fastcgicache:18m inactive=6m max_size=18m;
    fastcgi_cache_key $scheme$request_method$host$request_uri;
    fastcgi_cache_use_stale error timeout invalid_header updating http_500;

    server {

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

    ## password protect the login and admin section
    ## this section has no fastcgi_cache info in it so it doesn't get cached.
    location ~ ^/(?:admin|admin.php|login.php) {
    auth_basic "Restricted";
    auth_basic_user_file /usr/local/some/folder/.htpasswd;
    access_log /usr/local//log/admin-access.log;
    expires 0;
    add_header Cache-Control "no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0";
    location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    if (!-f $document_root$fastcgi_script_name) {
    return 404;
    }
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    }
    }

    location ~ [^/]\.php(/|$) {
    fastcgi_split_path_info ^(.+?\.php)(/.*)$;
    if (!-f $document_root$fastcgi_script_name) {
    return 404;
    }
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_index index.php;
    include fastcgi_params;
    add_header X-Cache $upstream_cache_status;
    fastcgi_cache fastcgicache;
    fastcgi_cache_min_uses 1;
    fastcgi_cache_valid 10m;
    }
    }
    }



  • Welp I give up on the shorter urls thing. If anyone ever figures it out I hope it gets posted ;)

  • Ok, I understood for configuration, thanks :-)
    I prefer stick to Debian packages and PHP calls, even tough a good cache for FP would be great, at least as regards entry parsing...

    For shorten URLs I can help you with my urls plugin - RewriteURLs.
    You need to look for each loadCache and change $y.$m or similar things to 'entries', whereas you have to leave cats where there is cats.

    You should also check every $this->cache to remove the day and check only the name.
    There is somethink like $this->cache[$name][$day][$name], it should changed to something like $this->cache['entries'][$name].

    This would do the trick.

    I'm sorry, I'd help you more, but I don't remember very well the code, I've written it more than one year and a half ago...
  • Sorry for the late reply, been busy. When I get some free time I'll look into the url options. Thanks m8.


    The debian standard packages are fine, I just like to compile and use a minimal install. Its not needed, just personal preference ;)

    The standard nginx install has had the fcgi cache in it for a ages. Its extremely fast. I only use opcache for php and the nginx fcgi cache. No memcache or anything else other than a few small restrictive tmpfs folders.

    If you have the time try it out. When using fcgi cache from a tmpfs there's 0 disk io's and all data is served as static content and from ram. Its also amazing for anything that needs a database. As it caches all the output with 0 db calls. Pretty much works on any cms.

    I also tossed together a simple php file to clear the cached data if needed. Mostly because I set the cache valid time @ a few days.

    Anyway time for foooooood :)

    Thanks for the URL info m8, have a good one.
  • Thanks, however I'd like to maintain some features like random tagcloud, last comments and counter...
    I'd like to use tmpfs, too, but I have a small amount of RAM, sadly...

    Regards
Start a New Discussion

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion