AVS环境要求
- PHP:建议版本5.6,虽然官方说7.0完全支持PHP7了,但是实际上并不是如此。所以如果不想踩坑,还是老老实实用5.6吧。
- MYSQL
- Nginx/Apache
- 官方文档
- Linux Server
- Apache Web Server
- Support for AcceptPathInfo
- Support for MultiViews (or mod_rewrite which is slower)
- MySQL / MySQLi
- PHP 5.x / 7.x (mod_php/CGI)
- Support for GD2 Library
- Support for MySQL / MySQLi
- Support for Curl
- Recommended PHP Configuration
- safe_mode off
- open_basedir off
- max_execution_time 7200
- max_input_time 7200
- memory_limit (with 1MB more then the maximum video upload size)
- post_max_size (maximum video upload size)
- upload_max_size (maximum video upload size)
- exec() should be allowed
- PHP CLI 5.x (see above + register_argc_argv ON)
- FFmpeg (Recommended Version: 3+)
环境配置
- 一台干净的Ubuntu服务器
安装宝塔
1
2
3wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && sudo bash install.sh
# 完成后打开管理页面:http://ip:8888
# 安装AVS的环境:PHP5.6、Mysql、Nginx(建议使用)、phpmyadmin安装视频插件ffmpeg,官方推荐3.x版本
1
2
3
4
5
6cd
wget https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-3.3.4-64bit-static.tar.xz
tar -xJf ffmpeg-3.3.4-64bit-static.tar.xz
cd ffmpeg-3.3.4-64bit-static
cp ffmpeg /usr/bin
cp ffprobe /usr/bin下载好AVS代码,根据AVS环境文档配置
安装网站
- 在宝塔后台建立一个网站,点击网站=>添加站点,按要求添加,其中建立数据库avs7,记录好相应的账号密码
在此站点下增加伪动态配置
1
2
3
4
5
6
7
8
9
10
11location / {
if (!-f $request_filename){
set $rule_1 1$rule_1;
}
if (!-d $request_filename){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite /.* /loader.php last;
}
}导入avs的sql脚本sql/avs.sql
1
2
3mysql -u root -p
mysql>use avs7
mysql>source sql/avs.sql源码修改,源码在upload目录,按以下要求修改
- Edit include/config.paths.php and set $config[‘BASE_URL’] to your site’s url.
- OPTIONAL: If you use a subdirectory for your installion set $config[‘RELATIVE’] to your subdirectory (eg: $config[‘RELATIVE’] = ‘/subdirectory’)!
- OPTIONAL: If you use a subdirectory for your installation edit loader.php and set $relative to your subdirectory (eg: $relative = ‘/subdirectory’)!
- Create a database. Edit include/config.db.php and set the database information (name, user and password).
- Import the sql dump from sql/avs.sql in your database (most likely using phpMyAdmin).
- Upload all files and folders from /upload to your server.
Chmod following files and directories to 0777. You can also fix the file/directory permissions from the admin panel: Settings > General > System Check
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/include/config.local.php
/cache/frontend
/cache/backend
/images/logo
/images/notice_images
/images/notice_images/thumbs
/media/albums
/media/categories/game
/media/categories/album
/media/categories/video
/media/csv
/media/games/swf
/media/games/tmb
/media/games/tmb/orig
/media/photos
/media/photos/tmb
/media/player/logo
/media/users
/media/users/orig
/media/videos/tmb
/media/videos/vid
/media/videos/h264
/templates/backend/default/analytics/analytics.tpl
/templates/emails
/templates/emails/*.tpl
/templates/frontend/(your_template)/static/*.tpl
/tmp/albums
/tmp/avatars
/tmp/downloads
/tmp/logs
/tmp/sessions
/tmp/thumbs
/tmp/uploader
/aembed.shGo to www.domain.com/siteadmin (login using: admin/admin) and start configuring your website.
- You can use the Google Video Sitemap generator using the link: http://www.yourdomain.com/sitemap.php
- Enable non-www to www redirection (domain.com to www.domain.com) by editing the .htaccess file and replacing “domain.com” with your domain name.
- 访问站点
后台地址http://xx.com/siteadmin,用户名和密钥都是admin,进入后咱们访问Settings-General-System Check,检查环境能否满意。
其他
- 这个程序的模板默认会在前台调用一个Google的js,我们需要替换改成国内的地址,不然你的站点在国内打开会非常慢。
修复路径:templates/frontend/主题名/header.tpl,将里面的:https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js改为:https://cdn.bootcss.com/jquery/1.11.1/jquery.min.js - 如果提示open_basedir有问题,那么注释掉网站目录下.user.ini中open_basedir
修改classes/email.class.php:4,添加其他头依赖
1
2
3
4
5
6use PHPMailer\PHPMailer\PHPMailer;
if ( !class_exists('PHPMailer') ) {
require $config['BASE_DIR']. '/include/phpmailer/PHPMailer.php';
require $config['BASE_DIR']. '/include/phpmailer/SMTP.php';
require $config['BASE_DIR']. '/include/phpmailer/Exception.php';
}主题模板会调用google的js脚本,需要将他们替换掉,主题目录templates/frontend/主题名,
- 替换embed.tpl、enter.tpl、header.tpl、view.tpl中的”https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"为"https://cdn.bootcss.com/jquery/1.11.1/jquery.min.js
“ - 替换feedback.tpl、invite.tpl、
grep: img: Is a directory中的”https://www.google.com/recaptcha/api.js"为"https://www.recaptcha.net/recaptcha/api.js" - 替换modules/captcha/recaptchalib.php中的”https://www.google.com/recaptcha/api/siteverify"为"https://www.recaptcha.net/recaptcha/api/siteverify"
- 替换embed.tpl、enter.tpl、header.tpl、view.tpl中的”https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"为"https://cdn.bootcss.com/jquery/1.11.1/jquery.min.js
- 配置include/config.local.php的recaptcha_site_key和recaptcha_secret_key