vbox安装lnmp部署laravel过程和遇到的问题

环境

vbox6.1 Ubuntu18.04、安装lnmp环境1.6

安装过程

  1. 执行lnmp提供的脚本
wget http://soft.vpser.net/lnmp/lnmp1.6.tar.gz -cO lnmp1.6.tar.gz && tar zxf lnmp1.6.tar.gz && cd lnmp1.6 && ./install.sh lnmp
  1. 设置共享目录 E:/fras => /home/wwwroot/fras
  2. 使用lnmp命令添加网站
# root @ Ubuntu in /home/wwwroot/fras [13:28:14]
$ lnmp vhost add
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Please enter domain(example: www.lnmp.org): www.fras.test  
 Your domain: www.fras.test
Enter more domain name(example: lnmp.org *.lnmp.org): 
Please enter the directory for the domain: www.fras.test
Default directory: /home/wwwroot/www.fras.test: /home/wwwroot/fras/fras-php/public
Virtual Host Directory: /home/wwwroot/fras/fras-php/public
Allow Rewrite rule? (y/n) y
Please enter the rewrite of programme, 
wordpress,discuzx,typecho,thinkphp,laravel,codeigniter,yii2 rewrite was exist.
(Default rewrite: other): laravel
You choose rewrite: laravel
Enable PHP Pathinfo? (y/n) y
Enable pathinfo.
Allow access log? (y/n) y
Enter access log filename(Default:www.fras.test.log):  
You access log filename: www.fras.test.log
Create database and MySQL user with same name (y/n) m
Add SSL Certificate (y/n) n

最后回车确定

问题

500错误

500错误很大概率是因为开启了.user.ini防跨站设置,bt面板和lnmp都有设置
https://lnmp.org/faq/lnmp-vhost-add-howto.html#user.ini

# ming @ Ubuntu in ~/lnmp1.6/tools [13:38:53] 
$ cd ~/lnmp1.6/tools 

# ming @ Ubuntu in ~/lnmp1.6/tools [13:39:05] 
$ ./remove_open_basedir_restriction.sh 
Error: You must be root to run this script!

# ming @ Ubuntu in ~/lnmp1.6/tools [13:39:18] C:1
$ sudo ./remove_open_basedir_restriction.sh
[sudo] ming 的密码: 
+-------------------------------------------------------------------+
|   Remove open_basedir restrication for LNMP, Written by Licess    |
+-------------------------------------------------------------------+
|       A tool to remove open_basedir restrication for LNMP         |
+-------------------------------------------------------------------+
|       For more information please visit https://lnmp.org          |
+-------------------------------------------------------------------+
|          Usage: ./remove_open_basedir_restrication.sh             |
+-------------------------------------------------------------------+
Enter website root directory: /home/wwwroot/fras/fras-php/public

回车即可删除和取消

403错误

一般为配置的根目录出错了,建议仔细查看

404错误
  • nginx没有访问权限(可以查看/home/wwwlogs/nginx_error.log的报错),lnmp是创建了一个www用户作为安装用户
# ming @ Ubuntu in ~/lnmp1.6/tools [13:40:55] 
$ sudo usermod -aG vboxsf www

# ming @ Ubuntu in ~/lnmp1.6/tools [13:45:56] 
$ cat /etc/group | grep vboxsf
vboxsf:x:999:root,ming,www

# ming @ Ubuntu in ~/lnmp1.6/tools [13:47:04] 
$ sudo lnmp restart 
+-------------------------------------------+
|    Manager for LNMP, Written by Licess    |
+-------------------------------------------+
|              https://lnmp.org             |
+-------------------------------------------+
Stoping LNMP...
Stoping nginx...  done
[ ok ] Stopping mysql (via systemctl): mysql.service.
Gracefully shutting down php-fpm . done
Starting LNMP...
Starting nginx...  done
[ ok ] Starting mysql (via systemctl): mysql.service.
Starting php-fpm  done
  • “No input file specified”
    在创建网站时,pathinfo要记得开启,如果没开启,可以手动更改配置vim /usr/local/nginx/conf/vhost/www.fras.test.conf
将 
include enable-php.conf 
改成
include enable-php-pathinfo.conf

最后重启即可

声明

声明:www.mingzaily.com|版权所有,违者必究
转载:转载请注明原文链接

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值