虚拟机跑下试试 [提示权限问题的话请使用root]
1. 更新系统软件
apt-get update
apt-get -y upgrade
apt-get install -y software-properties-common curl
2. 下载优化后的安装脚本
wget https://raw.githubusercontent.com/summerblue/laravel-ubuntu-init/master/deploy-16.sh
chmod +x deploy-16.sh
3. 修改密码
# Configure
MYSQL_ROOT_PASSWORD="125801(实际需要复杂密码)"
MYSQL_NORMAL_USER="estuser"
MYSQL_NORMAL_USER_PASSWORD="125801(实际需要复杂密码)"
4. 加速(可能需要)
wget http://mirrors.163.com/.help/sources.list.trusty -O /etc/apt/sources.list
5. 安装
> sudo ./deploy-16.sh
6. 配置
新建
/data/www
(根目录) 目录/data/log/nginx
(日志目录)
sudo chmod -R 777 log (日志写入权限)
克隆项目
cd /data/www
git clone https://gitee.com/lixxxxxxx15/larbbs.git
安装可能缺少的扩展
sudo apt-get -y install php7.1-mysql
sudo apt-get install php7.1-mbstring
sudo apt-get install php7.1-xml
sudo apt-get install php7.1-gd
安装依赖
composer install
配置env
:数据库等信息
cp .env.example .env
秘钥生成
php artisan key:generate
填充数据
php artisan migrate --seed
配置host文件
sudo vim /etc/hosts
#添加虚拟域名
127.0.0.1 larbbs.test
7. 配置nginx
# 权限设置
cd /data/www/larbbs
chown www:www -R ./
#nginx配置文件设置
sudo vim /etc/nginx/sites-enabled/larbbs.test
server {
listen 80;
server_name larbbs.test;
root /data/www/larbbs/public;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log /data/log/nginx/larbbs-access.log;
error_log /data/log/nginx/larbbs-error.log error;
sendfile off;
client_max_body_size 100m;
include fastcgi.conf;
location ~ /\.ht {
deny all;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass /run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
8. bug处理
nginx 80端口被占用:删除
apche
sudo apt-get --purge remove apache-common
sudo apt-get --purge remove apache
sudo find /etc -name "apache" |xargs rm -rf
sudo rm -rf /var/www
sudo rm -rf /etc/apache2
访问显示 storage/framework/cache 报错:
添加写入权限
chmod -R 777 storage
待续....
9.测试启动
service nginx restart
访问成功
网友评论