一个基于laravel5.4最佳实践的cms程序,使用众多现代web开发特性。
!!!如果你在安装过程中遇到任何问题,请不要犹豫,立即提出Issue。我会全力帮助你!!!
git clone git@github.com:shellus/shcms.git
cd shcms
chmod -R 777 storage public/uploads
composer install
bower install
cp .env.example .env
编辑.env
文件:
修改数据库连接信息 DB_*
设置网站名称和副标题 APP_NAME, APP_SUB_NAME
修改APP_URL
,改为可访问到的url,否则邮件中和cli中无法获取正确的url。
创建数据库shcms
生成app_key和填充数据库
php artisan key:generate
php artisan migrate
php artisan db:seed
添加cron条目
* * * * * php /path/to/shcms/artisan schedule:run
添加开机启动(开发环境可以手动运行 bin/queue-listener.bat )
php /path/to/shcms/artisan queue:listen --timeout 0
可选的优化
php artisan config:cache
php artisan route:cache
php artisan optimize
如果你需要支持文章阅读时长统计,那么你需要运行 php artisan ws
这将使用8080端口, 你可以使用 supervisor
来运行它
sudo apt install -y supervisor
sudo vim /etc/supervisor/conf.d/ws.conf
supervisor 推荐配置
[program:ws]
directory=path/to/shcms/
command=php artisan ws
user=www-data
[program:queue-default]
directory=path/to/shcms/
process_name=%(program_name)s_%(process_num)02d
command=php artisan queue:work --queue=default --sleep=3 --tries=1
autostart=true
autorestart=true
user=www-data
numprocs=1
[program:queue-high]
directory=path/to/shcms/
process_name=%(program_name)s_%(process_num)02d
command=php artisan queue:work --queue=high --sleep=3 --tries=1
autostart=true
autorestart=true
user=www-data
numprocs=4
然后使新的配置生效
sudo service supervisor restart
如果websocket
运行不稳定,那么你可以使用cron
在每天凌晨使用 sudo supervisorctl restart ws
重启它
如果你部署SSL访问,那么需要对websocket做反向代理来实现wws://协议
nginx.conf:
upstream shcms.endaosi.com {
server 127.0.0.1:8080;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen 443 ssl;
server_name shcms.endaosi.com;
location ^~ /websocket {
proxy_pass http://shcms.endaosi.com;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
编辑.env
文件,修改数据库连接信息
php artisan key:generate
php artisan migrate
php artisan db:seed
bower install
参见Issue列表
有任何问题和疑问请在github建立Issue,我会尽快回复您
欢迎您使用、学习、参与本项目。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。