A lightweight, file-based blog system written in PHP with built-in admin interface.
- π File-based: No database required - posts stored as Markdown files
- π¨ Built-in Editor: Web-based admin interface for writing posts
- π Multilingual: Built-in i18n support (English, German)
- π·οΈ Tag System: Organize posts with tags and tag clouds
- π± Responsive: Mobile-friendly design
- π Secure: CSRF protection, bcrypt password hashing, session management
- π Fast: Cached index for quick page loads
- π‘ RSS Feed: Automatic RSS generation
- πΊοΈ Sitemap: SEO-friendly XML sitemap
- π Private Posts: Share drafts via secure token URLs
- PHP 8.0 or higher (tested with PHP 8.4)
- Web server with PHP support (Apache, Nginx, or PHP built-in server)
-
Clone the repository:
git clone https://github.com/jurgen178/bitblog.git cd bitblog -
Set up admin credentials:
First time setup - visit
http://localhost:8000/admin.phpand the setup wizard will guide you through creating an admin account.OR manually edit
src/Config.php:public const ADMIN_USER = 'yourusername'; public const ADMIN_PASSWORD_HASH = '$2y$12$...'; // Use generate_password.php
-
Start the development server (local testing):
php -S localhost:8000
-
Access your blog:
- Homepage: http://localhost:8000
- Admin Panel: http://localhost:8000/admin.php
-
Upload files to your web server:
- Copy all files to your web server's document root
- Ensure the web server user (e.g.,
www-data,apache) has write permissions for:- The entire BitBlog directory (for generating index files, static pages, etc.)
cache/directory (for generated cache files)content/directory (for creating/editing posts)settings.json(for saving configuration)
-
Set permissions:
cd /path/to/bitblog chmod -R 775 . chown -R www-data:www-data .
-
Configure Apache:
- Point document root to the BitBlog directory
- Enable
.htaccessif using URL rewriting - Ensure PHP is enabled and version 8.0+ is available
-
Security:
- Set up admin credentials in
src/Config.php - Use HTTPS in production
- Consider restricting
/admin.phpaccess by IP if possible
- Set up admin credentials in
-
Copy files to IIS:
- Copy all files to your IIS website directory (e.g.,
C:\inetpub\wwwroot\bitblog) - Ensure the IIS application pool identity (e.g.,
IIS_IUSRS,NETWORK SERVICE) has write permissions for:- The entire BitBlog directory (for generating index files, static pages, etc.)
- All subdirectories and files
- Copy all files to your IIS website directory (e.g.,
-
Set permissions (using PowerShell):
# Grant write access to entire BitBlog directory icacls "C:\inetpub\wwwroot\bitblog" /grant "IIS_IUSRS:(OI)(CI)M" /T
-
Configure IIS:
- Install PHP using Web Platform Installer or manually
- Enable PHP FastCGI in IIS
- Set default document to
index.php - Configure
web.configfor URL rewriting (already included in repo)
-
Security:
- Set up admin credentials in
src\Config.php - Enable HTTPS binding in IIS
- Consider IP restrictions for
/admin.phpin IIS Manager
- Set up admin credentials in
blog-test/
βββ index.php # Main blog frontend
βββ admin.php # Admin interface router
βββ src/ # Application classes
β βββ Config.php # Site configuration
β βββ Content.php # Content management
β βββ Router.php # URL routing
β βββ ...
βββ admin/ # Admin interface files
β βββ login.php # Login form
β βββ editor.php # Post editor
β βββ admin.css # Admin styles
βββ templates/ # HTML templates
βββ content/ # Your content
β βββ posts/ # Blog posts (.md files)
β βββ pages/ # Static pages
βββ cache/ # Generated cache files
βββ assets/ # CSS, images, etc.
- Homepage:
/or/index.php - Single Post:
/index.php?id=123 - Tag Archive:
/index.php?tag=php - Page:
/index.php?page=about - RSS Feed:
/feed.xmlor/index.php?feed=1 - Sitemap:
/sitemap.xml - Admin Panel:
/admin.php
Edit src/Config.php to customize defaults:
public const SITE_TITLE = 'Your Blog Name';
public const POSTS_PER_PAGE = 5;
public const RSS_POSTS_LIMIT = 100;
public const TIMEZONE = 'Europe/Berlin';
public const DEFAULT_LANGUAGE = 'en'; // or 'de'Runtime settings can also be changed via the admin panel (/admin.php?settings).
- Password Hashing: Uses bcrypt (cost 12) for secure password storage
- CSRF Protection: All forms protected against CSRF attacks
- Session Security: Secure session management with httponly cookies
- Input Validation: All user inputs are sanitized and validated
- Private Posts: Secure token-based access for draft sharing
- Change admin credentials before production deployment
- Use HTTPS in production
- Keep PHP updated
BitBlog supports multiple languages out of the box:
- English (en)
- German (de)
To add a new language:
- Copy
src/lang/template.jsontosrc/lang/xx.json(e.g.,fr.json) - Translate all strings
- Set
_localefield (e.g.,"_locale": "fr_FR")
See TRANSLATION_GUIDE.md for details.
-
Access the admin panel:
- Navigate to
http://yoursite.com/admin.php - Log in with your credentials
- Navigate to
-
Create a new post:
- Click "π New Post" in the admin panel
- Fill in the title, date, and status (draft/published/private)
- Add tags to organize your content
- Write your content using the built-in Monaco Editor (Visual Studio Code editor)
- See live preview of your post in real-time
-
Editor features:
- Markdown toolbar: Quick buttons for bold, italic, code, links, tables
- Live preview: See rendered output as you type
- Fullscreen mode: Distraction-free writing (F11)
- Dark/Light theme: Switch editor theme
- Font size control: Adjust text size (A+/A-)
- Keyboard shortcuts: Ctrl+B (bold), Ctrl+I (italic), Ctrl+K (link), Ctrl+S (save)
-
Post status:
- Published: Visible to everyone
- Draft: Hidden from public, only visible in admin
- Private: Only accessible via secure token URL (perfect for sharing drafts)
Posts are Markdown files with YAML front matter stored in content/posts/:
---
title: My Blog Post
status: published
tags: [php, blog, web]
---
# My Blog Post
Content goes here in **Markdown** format.File naming convention: YYYY-MM-DDTHHMM.ID.md (e.g., 2025-11-15T1430.123.md)
- The date in the filename is in UTC
- The ID is auto-generated and unique
- π Editor: Write posts in Markdown with live preview powered by Visual Studio Code
- π Dashboard: Overview of all posts with status
- π Index Rebuild: Regenerate cache after bulk changes
- ποΈ Delete Posts: Remove posts with confirmation
- π Preview: View posts before publishing
- Mobile-friendly interface
- Tag cloud for easy navigation
- Pagination for large blogs
- Clean, readable typography
- Automatic sitemap generation
- RSS feed for subscribers
- Clean URLs
- Meta tags and descriptions
- Performance optimization with caching
published: Visible on the blogdraft: Hidden from public viewprivate: Accessible only via direct link
- PHP 8.0+ (tested with PHP 8.4)
- No database required
- Web server with PHP support
- Edit templates in
/templates/for layout changes - Modify CSS in
/assets/style.cssfor styling - Admin interface styles in
/admin/admin.css
Contributions are welcome! Please read CONTRIBUTING.md and DEVELOPER_STANDARDS.md before submitting PRs.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with ParsedownExtra for Markdown processing
- Inspired by simple, file-based CMS systems
BitBlog - Lightweight, secure, and fast!