nginx php 404 not found,Laravel Nginx出现404 Not Found错误
问题
刚刚开始用了几天Laravel,发现URL路由有点问题,http://localhost:8017/laravel能正常打开,不过http://localhost:8017/laravel/foo返回
404 Not Found
系统为Ubuntu 16.04,Laravel 5.4
routes/web.php
Route::get('/', function () {
return view('welcome');
});
// oedin
Route::get('foo', function () {
return 'Hello World';
});
nginx配置文件:
server {
listen 8017 default_server;
listen [::]:8017 default_server;
# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;
#root /var/www/html;
root /home/oedin/webdev;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;
#try_files $uri /index.php =404;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
#fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
#include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
最佳答案
如果你想要你的应用与nginx使用,推荐新建一个nginx vhost配置文件,其中包含你的项目root目录。
不过可以直接执行php artisan serve命令来提供服务,这样不需要nginx。
nginx php 404 not found,Laravel Nginx出现404 Not Found错误相关推荐
- nginx缓存HtmL文件,Nginx在缓存的html文件上返回404
我试图在没有索引页的所有.html文件中添加缓存,但是当我做了一些更改时,我的文件进入了404找不到页面.Nginx在缓存的html文件上返回404 这是我对我的默认配置,没有任何改变,我做了,没有工 ...
- laravel nginx配置_nginx高可用
传统的高可用思路 tomcat的高可用的思路,是在tomcat集群前面加一层负载服务nginx.如下图 这种做法,解决了tomcat的高可用问题.但是引入了前面的负载机器的高可用问题(Nginx如果挂 ...
- macos nginx php mysql_mac环境下搭建nginx + php + mysql开发环境
1.安装homebrew(mac下好用的包管理器) 第一步,获取install文件 把官网给的脚本拿下来 curl -fsSL https://raw.githubusercontent.com/Ho ...
- centos6.3 nginx php,CentOS 6.3下nginx、php-fpm、drupal快速部署
一切本着从简原则来做,能yum/rpm的,坚决不手工编译 :) 本次部署环境基于CentOS 6.3 x86_64系统. 0. 准备工作#更新yum[root@imysql ~]# yum -y up ...
- nginx文件系统大小_详解Nginx系列
1.Nginx特点 Nginx是一个事件驱动架构,而非传统过程驱动架构.具有内存占用低,当并发连接大时,能够预测内存使用率.Nginx改变了传统的web服务器体系架构,提高了响应速度,起初Nginx开 ...
- nginx配置php项目后403,nginx配置引发的403问题解决办法
nginx配置引发的403问题解决办法 一.问题:在curl nginx配置的本地域名时出现403 nginx_error.log日志如下: 二.疑问 1.www.requesturi.com配置如下 ...
- 源码包nginx 配置php,源码安装Nginx和PHP
1.安装编译环境 yum -yinstall gcc gcc-c++ automake autoconf libtool make glibc yum -y install libmcrypt-dev ...
- Linux离线的nginx安装启动,linux-离线安装nginx
1.安装Nginx及相关组件 1.1 openssl安装 # 问题 md5-x86_64.s: Assembler messages: md5-x86_64.s:41: Error: 0xd76aa4 ...
- Nginx学习总结(13)——Nginx 重要知识点回顾
一.Nginx的由来 没有听过Nginx?那么一定听过它的"同行"Apache吧!Nginx同Apache一样都是一种WEB服务器.基于REST架构风格,以统一资源描述符(Unif ...
最新文章
- 7分钟分析人类全基因组,他们刷新全球纪录,此前最快也要24小时
- C中常用字符串处理函数
- Owasp live CD 2011下载地址
- 关于Mysql5.7高版本group by新特性报错
- vue报错vue-router.esm.js?8c4f:2062 Uncaught (in promise) Error: Avoided redundant navigation to curren
- 关抢占 自旋锁_互斥锁、自旋锁、读写锁、悲观锁、乐观锁的应用场景
- 成功创业者所需的能力
- Java继承_java练习本(20190617)
- Android8有深度休眠吗,IMX8MQ android休眠功耗过大
- OpenCV3学习(10.2)codebook码书法实现背景剔除
- java数组实验心得体会_学习JAVA之数组小结
- 戴AirPods pro走路会传来咚咚的脚步声,有什么办法能消除这个声音?
- jquery 弹出遮罩层
- 蓝桥杯 算法提高 全排列 next_pertumutation
- 中药的专利标准化研究
- Android AIDL原理
- python怎么编写口算题_用Python开发小学二年级口算自动出题程序
- 网络操作系统 Linux配置与管理,网络操作系统—Linux配置与管理
- scp命令默认传输速度多大_加速scp传输速度
- Fuchsia Fundamentals