Cockpit是轻量、开源的内容管理系统,不同于WordPress、Drupal等传统的CMS,它专注于简洁、轻量。
Cockpit was born out of the need of building a simple dynamic site. Sure, WordPress, Joomla, Drupal and all the other full-stack content management systems are possible solutions for that task … but let’s be honest, often they are just too bloated and too time consuming to setup, maintain and too complex implementing custom functionality.
特性:
Cockpit的后台数据库使用SQLite(或MongoDB)。
Cockpit的源代码:https://github.com/COCOPi/cockpit
Ubuntu 16.04 安装 Cockpit CMS
#1 安装SQLite
1 |
$ sudo apt install sqlite3 libsqlite3-dev |
#2 安装PHP和PHP模块
1 |
$ sudo apt install php-fpm php-cli php-json php-curl php-gd php-common php-sqlite3 |
#3 配置PHP(/etc/php/7.0/fpm/php.ini)
PHP内存限制大小:
1 |
$ sudo sed -i "s/memory_limit = .*/memory_limit = 128MB/" /etc/php/7.0/fpm/php.ini |
fix_pathinfo = 0:
1 |
$ sudo sed -i "s/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini |
设置时区:
1 |
$ sudo sed -i "s/;date.timezone.*/date.timezone = UTC/" /etc/php/7.0/fpm/php.ini |
upload_max_filesize和post_max_size:
1 2 |
$ sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.0/fpm/php.ini $ sudo sed -i "s/post_max_size = .*/post_max_size = 100M/" /etc/php/7.0/fpm/php.ini |
重启PHP-FPM服务:
1 |
$ sudo service php7.0-fpm restart |
#4 下载Cockpit
1 2 3 4 |
$ sudo mkdir -p /var/www/ $ cd /var/www/ $ sudo apt install git $ sudo git clone https://github.com/COCOPi/cockpit |
更改目录所有者:
1 |
$ sudo chown www-data:www-data -R cockpit |
#5 安装配置Nginx
1 |
$ sudo apt install nginx |
配置Nginx:
1 |
$ sudo vim /etc/nginx/sites-available/cockpit |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
server { listen 80; server_name your_domain.com; root /var/www/cockpit; index index.php; location / { try_files $uri $uri/ /index.php; } access_log /var/log/nginx/cockpit.access.log; error_log /var/log/nginx/cockpit.error.log; # Deny direct access to .sqlite location ~ .sqlite$ { deny all; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param COCKPIT_URL_REWRITE On; fastcgi_intercept_errors off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; } location ~ /\.ht { deny all; } } |
注意替换域名。
激活配置文件:
1 |
$ sudo ln -s /etc/nginx/sites-available/cockpit /etc/nginx/sites-enabled/cockpit |
测试Nginx配置:
1 |
$ sudo nginx -t |
重启Nginx:
1 |
$ sudo service nginx restart |
#6 完成安装
使用浏览器访问:your_domain.com/install:
Ok,安装完成,使用户名admin,密码admin登录:
Cockpit文档:http://getcockpit.com/docs