您的位置 首页 php

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视频教程】

文章来源:智云一二三科技

文章标题:laravel在nginx中能配置到已有站点路径吗?

文章地址:https://www.zhihuclub.com/24454.shtml

关于作者: 智云科技

热门文章

网站地图