安装后,nginx访问virtualbox挂载的目录各种打不通。
先要把/media/sf_public的用户和组改了,可是改不了,只能改nginx的用户为root,并且php-fpm的用户和组改为www 和 vboxsf,不允许改为root,这时才不会报403和not input file…
然后要进入lnmp1.4/tool/执行里面的remove_open_basedir_restriction.sh把对应的网站目录的.user.ini干掉,网站的/public才能正常加载上级的目录文件的引用,坑爹啊,搞了好几天。重装了无数次lnmp版本。
最后还要配置主机路由重写,现在把nginx vhost备份上:
server
{
listen 80;
#listen [::]:80;
server_name sa-git-ubuntu.cc ;
index index.html index.htm index.php default.html default.htm default.php;
root /media/sf_public/sa-git/public;
include none.conf;
#error_page 404 /404.html;
rewrite ^/(.*)/$ /$1 permanent;
if (!-d $request_filename){
set $rule_1 1$rule_1;
}
if (!-f $request_filename){
set $rule_1 2$rule_1;
}
if ($rule_1 = "21"){
rewrite ^/ /index.php last;
}
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php.conf;
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\.
{
deny all;
}
access_log /home/wwwlogs/sa-git-ubuntu.cc.log;
}