Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Laravel nginx配置文件放在哪里?_Laravel_Nginx_Vagrant_Vuejs2_Html5 History - Fatal编程技术网

Laravel nginx配置文件放在哪里?

Laravel nginx配置文件放在哪里?,laravel,nginx,vagrant,vuejs2,html5-history,Laravel,Nginx,Vagrant,Vuejs2,Html5 History,我明白我应该把这段代码放到HTML5历史回退的地方: location / { try_files $uri $uri/ /index.html; } 但是到哪个文件?尝试搜索google,没有任何效果,将上述代码放入/etc/nginx/nginx.conf将使nginx无法工作 我在用流浪者的家园为拉威尔服务 请提供帮助。这是nginx.conf文件的条目,位于 /etc/nginx/nginx.conf 将此添加到配置: location / { try_files $uri

我明白我应该把这段代码放到HTML5历史回退的地方:

location / {
  try_files $uri $uri/ /index.html;
}

但是到哪个文件?尝试搜索google,没有任何效果,将上述代码放入/etc/nginx/nginx.conf将使nginx无法工作

我在用流浪者的家园为拉威尔服务


请提供帮助。

这是
nginx.conf
文件的条目,位于

/etc/nginx/nginx.conf
将此添加到配置:

location / {
  try_files $uri /index.html;
}

将配置放入
/etc/nginx/nginx.conf

server { 
    location / {
      try_files $uri $uri/ /index.html;
    } 
}

最后,我让nginx使用html5回退

打开/etc/nginx/site available/homestad.app或homestad.yaml文件中指定的任何域

将“位置”部分放置/替换为

    location / {
      try_files $uri $uri/ /index.php;
    }
然后保存并打开laravelweb.php(路由器)。请输入以下代码:

Route::get('/{vue?}/{vue2?}/{vue3?}', function () {
//    return view('welcome');
    if ( ! request()->ajax() ) {
        return view('index');
    }
});
以上代码防止laravel返回错误404。现在vue html5历史回退功能可以在没有#符号的情况下工作


谢谢大家的帮助,没有你们的帮助,我可能不知道如何解决这个问题。

你能具体说明你面临的错误是什么吗?是的,配置应该放在
/etc/nginx/nginx.conf中。
我把代码放在/etc/nginx/nginx.conf中,当我'sudo service nginx restart'时,错误为'nginx.service的作业失败,因为控制进程已退出,并显示错误代码。有关详细信息,请参阅“systemctl status nginx.service”和“journalctl-xe”。运行此命令
less/var/log/nginx/error.log
&查看有哪些错误。这里是错误>2017/06/17 01:24:59[emerg]1340#1340:/etc/nginx/nginx.conf:87>2017/06/17 01:27:33[emerg]1369:“location”在/etc/nginx/nginx.conf:87>2017/06/17 01:44:16[emerg]2851#2851中不允许使用指令/etc/nginx/nginx.conf:66中不允许使用“位置”指令这是我在/etc/nginx/nginx.conf>2017/06/17 01:24:59[emerg]1340#1340:“位置”中提到的代码时出现的错误在/etc/nginx/nginx.conf:87>2017/06/17 01:27:33[emerg]1369#1369中不允许使用指令:在/etc/nginx/nginx.conf:87>2017/06/17 01:44:16[emerg]2851中不允许使用指令/etc/nginx/nginx.conf:66中不允许使用“位置”指令。我相信这是在
http{}中的
部分在运行Homeset时基本没有错误,但html5历史回退仍然不起作用查看对我答案的编辑,似乎您不需要
$uri/
尝试过它,下面是错误消息:>2017/06/17 01:55:02[emerg]3408#3408:/etc/nginx/nginx.conf:65>2017/06/17 01:55:06[emerg]3420#3420在/etc/nginx/nginx.conf:65中不允许使用“server”指令,只需确保
server{}
events{}
之上
http{}
@Ganesh,事件{}和http{}必须运行吗?