以root身份登录 不能在~/root/ 目录下 建立www 文件加 ,nginx 读取会有错误
配置vhost 主要在 /etc/nginx/sites-enabled/ 下
拷贝一份默认配置文件:
按照以下内容修改即可
```
server {
listen 80;
listen [::]:80;
root /home/userName/www/MySite/public;
index index.php index.html index.htm;
server_name mysite.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#这里使用对映的php 版本
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
}
```
然后就是注意配置 laravel 项目目录权限
主目录可访问
storage 和 bootstrap/cache 要可读写
chmod -R 666 storage bootstrap/cache