当前位置: 首页 > 后端技术 > PHP

百度云虚拟主机配置laravel

时间:2023-03-29 20:05:45 PHP

素材服务器:百度云虚拟主机(nginx+php5.6+linux)laravel5.4问题百度云默认目录是/wwwroot,但是我们的要求是把项目存放在/wwwroot/下网站。方案代码:location/{root/home/bae/app/website/public;if(-e$document_root/index.php){##获取正则匹配中的数据,wwwxxx.com/test/实际访问路径请www.xxx.com/index.php/test重写^/(.*)$/index.php/$1?$query_string最后;}return404;}##php配置位置~[^/]\.php(/|$){root/home/bae/app/website/public;fastcgi_indexindex.php;fastcgi_pass127.0.0.1:9000;fastcgi_intercept_errors开启;fastcgi_split_path_info^(.+\.php)(.*)$;fastcgi_paramPATH_INFO$fastcgi_path_infofastcgi_paramPATH_TRANSLATED$document_root$fastcgi_path_info;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;fastcgi_paramSCRIPT_FILENAME$document_root$fastcgi_script_name;fastcgi_paramQUERY_STRING$query_string;fastcgi_paramREQUEST_METHOD$request_method;fastcgi_paramCONTENT_TYPE$content_type;fastcgi_paramCONTENT_LENGTH$content_length;fastcgi_paramSCRIPT_NAME$fastcgi_script_name;fastcgi_paramREQUEST_URI$request_uri;fastcgi_paramDOCUMENT_URI$document_uri;fastcgi_paramDOCUMENT_ROOT$document_root;fastcgi_paramSERVER_PROTOCOL$server_protocol;fastcgi_paramREQUEST_SCHEME$方案;fastcgi_paramHTTPS$httpsif_not_empty;fastcgi_paramGATEWAY_INTERFACECGI/1.1;fastcgi_paramSERVER_SOFTWAREnginx/$nginx_version;fastcgi_paramREMOTE_ADDR$remote_addr;fastcgi_paramREMOTE_PORT$remote_port;fastcgi_paramSERVER_ADDR$server_addr;fastcgi_paramSERVER_PORT$server_port;fastcgi_paramSERVER_NAME$server_name;#仅限PHP,如果PHP是使用--enable-force-cgi-redirectfastcgi_paramREDIRECT_STATUS200;}location~.*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$构建的,则需要{root/home/bae/app/website/public;到期30d;access_logoff;}location~.*\.(js|css)?${root/home/bae/app/website/public;7天到期;access_logoff;}location~/\.ht{root/home/bae/app/website/public;denyall;}##禁止直接访问敏感文件位置~*\.(inc|bak|sql|lua|so|ini|conf)${denyall;}注意:当重复配置时,bcloud_nginx_user.conf有优先级高于bcloud_nginx_gen.conf。由于百度云将/webroot映射到系统中的目录为/home/bae/app,所以我们在配置nginx文件时需要设置root属性。文档百度云官方文档

最新推荐
猜你喜欢