laravel在nginx中能配置到已有站點路徑嗎?

下面由laravel教程欄目帶大家介紹關于laravel怎么在nginx中配置到一個已有站點的路徑下,希望對大家有所幫助!

問題描述:

laravel 如何在nginx中配置到一個已經有的站點的路徑下

現在配置文件如下,已經有一個站點在工作了。新建了一個laravel的工程,在其他路徑:/var/www/html/laravel.

如何配置才能正常訪問 sms.dev/laravel/path ?

server{ ????????listen?80; ????????server_name?sms.dev; ????????index?index.php?index.html?index.htm; ????????root?/var/www/html/sms; ????????location?/laravel/?{ ????????????#?這里如何配置呢? ????????} ????????location?~?.*.(php|php5)?$ ????????{ ????????????????fastcgi_pass??127.0.0.1:9000; ????????????????fastcgi_index?index.php; ????????????????include?fcgi.conf; ????????} ???????? ????????if?(!-e?$request_filename)?{ ????????????????return?404; ????????} }

解決辦法:

location?^~?/app/?{ ????alias?/var/www/laravel/public/; ????if?(!-e?$request_filename)?{?rewrite?^?/app/index.php?last;?} ????location?~?.php$?{ ????????if?(!-f?$request_filename)?{?return?404;?} ????????include?snippets/fastcgi-php.conf; ????????fastcgi_param?SCRIPT_FILENAME?$request_filename; ????????fastcgi_pass?unix:/run/php/php7.0-fpm.sock; ????} }

【相關推薦:laravel教程

以上就是

? 版權聲明
THE END
喜歡就支持一下吧
點贊10 分享