环境:vmwarephp7nginxmysqllaravel挂载目录 /mnt/hgfs/WWW/test/l/public首先是/usr/local/nginx/conf/vhost 下的test.com.confserver{ listen 80; #listen [::]:80;
server_name test.com test2.com; index index.html index.htm index.php default.html default.htm default.php; root /mnt/hgfs/WWW/test/l/public; include rewrite/laravel.conf; #error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
include enable-php-pathinfo.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 off;
}接下来是windows的host文件192.168.0.16 test.com问题:此时使用游览器访问test.com出现了404,域名指向挂载目录是行不通的吗,还是我配置错了?求大神
1 回答
婷婷同学_
TA贡献1844条经验 获得超8个赞
缺少nginx 与 php 通讯的地方
location ~ \.php(.*)$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; include fastcgi_params; }
添加回答
举报
0/150
提交
取消