ScaleScaleScaleScale

Tips / Nginx


Nginx configuration for Newscoop

Newscoop is a free open source content management system. It provides you a simple way to publish content online. It was originally developed to be used in newspaper and especially for content writers. However, let me advise you, in my experience it is not as good as it’s promoted. Today you can find everything this software offers in WordPress, plus more. But if you are tied to Newscoop don’t worry, here you have the rewrite rules to get newscoop working on Nginx

set $cs_root "";

# images, attachments
rewrite /get_img$ $cs_root/get_img.php break;
rewrite /attachment/ $cs_root/attachment.php break; 

# the large .htaccess block for redirecting into index.php
set $fixed_file "no";

if ($request_filename ~* ".(html|css|js|php|ico)$")
{
    set $fixed_file "yes";
}

set $fixed_cache "0";
if ($request_filename ~* "/+images/+cache") {
    set $fixed_cache "1";
}
if (!-f $request_filename) {
    set $fixed_cache "${fixed_cache}1";
}
if ($fixed_cache = "11") {
    rewrite .* $cs_root/index.php break;
    #set $fixed_file "yes";
}

# if ($request_filename ~* "(/+plugins/[Install Newscoop under Nginx^/]*)?/+(javascript|css|images)")
if ($request_filename ~* "(/+plugins/[^/]*)?/+(js|javascript|css|images)")
{
    set $fixed_file "yes";
}
if ($request_filename ~* "/(admin|install|templates|themes|videos)")
{
    set $fixed_file "yes";
}
if ($fixed_file = "no") {
    rewrite .* $cs_root/index.php break;
}

# templates
rewrite .tpl$ $cs_root/index.php break;

# admin interface
rewrite /admin$ $cs_root/admin.php break;
rewrite /admin/ $cs_root/admin.php break;
rewrite /admin-files $cs_root/admin.php break

Place it inside your location / {….} block and you should get your Newscoop working properly.

profile

Esteban Borges

Linux Geek, Webperf Addict, Nginx Fan. CTO @Infranetworking