pkg install nginx ca_root_nss mariadb104-server ffmpeg git
sysrc nginx_enable=yes
sysrc mysql_enable=yes
pkg install php80 php80-bcmath php80-ctype php80-exif php80-fileinfo php80-gd php80-mbstring php80-openssl php80-pdo php80-tokenizer php80-xml php80-zip php80-pecl-imagick php80-phar php80-filter php80-zlib php80-simplexml php80-dom php80-session php80-sqlite3 php80-mysqli php80-pdo_mysql
sysrc php_fpm_enable=yes
cd ~
php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
php composer-setup.php
php -r "unlink('composer-setup.php');"
mv composer.phar /usr/local/bin/composer
git clone https://hub.fastgit.xyz/LycheeOrg/Lychee.git /usr/local/www/lychee
cd /usr/local/etc/nginx
cp nginx.conf nginx.conf.backup
nano nginx.conf
# 编辑以下内容
server {
listen 80;
server_name localhost;
root /usr/local/www/lychee/public/;
index index.php;
if (!-e $request_filename)
{
rewrite ^/(.*)$ /index.php?/$1 last;
break;
}
location = /index.php {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_param HTTP_PROXY "";
fastcgi_pass unix:/tmp/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/lychee/public$fastcgi_script_name;
fastcgi_param PHP_VALUE "post_max_size=10240M
max_execution_time=200
upload_max_filesize=10240M
memory_limit=1024M";
fastcgi_param PATH /usr/local/bin:/usr/bin:/bin;
include fastcgi_params;
}
error_log /var/log/nginx/lychee.error.log;
access_log /var/log/nginx/lychee.access.log;
rewrite ^/(.+)/$ /$1 permanent;
location ~ [^/]\.php(/|$) {
return 403;
}
}
# 保存退出
cd /usr/local/www/lychee
composer install --no-dev
cd /usr/local/etc
cp php.ini-production php.ini
nano php.ini
# 取消以下条目开头的 ; 注释,并修改数值如下:
cgi.fix_pathinfo=1
date.timezone ="Asia/Shanghai"
memory_limit = 1024M
post_max_size = 10240M
upload_max_filesize = 10240M
# 保存退出
cd /usr/local/etc/php-fpm.d
nano www.conf
# 取消注释:
clear_env = no
listen = /tmp/php-fpm.sock
listen.mode=0666
# 保存退出
cd /usr/local/www
chown -R www:www lychee
nano /usr/local/etc/mysql/my.cnf
# 编辑以下内容
socket = /tmp/mysql.sock
# 保存退出
service mysql-server start
mysql_secure_installation --socket=/tmp/mysql.sock
mysql -u root
CREATE DATABASE lychee_db;
CREATE USER 'lychee_admin'@'localhost' IDENTIFIED BY 'XXX';
GRANT ALL ON lychee_db.* TO 'lychee_admin'@'localhost';
FLUSH PRIVILEGES;
exit
cd /usr/local/www/lychee
cp .env.example .env
nano .env
# 编辑以下内容
# DB_OLD_LYCHEE_PREFIX= # 把这一行注释掉
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=lychee_db
DB_USERNAME=lychee_admin
DB_PASSWORD=XXXX
TIMEZONE=Asia/Shanghai
# 修改完成后保存退出
cd config
nano app.php
# 编辑以下内容
'timezone' => env('TIMEZONE', 'Asia/Shanghai'),
'locale' => 'zh-CN',
/*
| When an exception is uncaught and the APP_DEBUG environment variable
| is true, the debug page will show all environment variables and their
| contents. In some cases you may want to obscure certain variables. You
| may do this by updating the debug_blacklist option in your config/app>
| configuration file.
| Some variables are available in both the environment variables and the
| server / request data. Therefore, you may need to blacklist them for >
| $_ENV and $_SERVER.
*/
'debug_blacklist' => [
'_ENV' => [
'APP_KEY',
'DB_PASSWORD',
],
'_SERVER' => [
'APP_KEY',
'DB_PASSWORD',
],
'_POST' => [
'password',
],
],
# 修改完成后保存退出
cd ..
php artisan key:generate
service php-fpm start
service nginx start
php artisan config:cache