Laravel 在 Nginx 中的参考配置两份
此份参考自网络:
server {
listen 80;
server_name laravel.app;
root /项目目录/public;
index index.php index.html index.htm;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
}
location ~ /\.ht {
deny all;
}
}
此份参考自 Homestead【有修改】
server {
listen 80;
server_name xxx.com;
root "/项目目录/public";
index index.html index.htm index.php;
# 无需用到 HTTPS 故注释
# listen 443 ssl http2;
# ssl_certificate /etc/nginx/ssl/xxx.com.crt;
# ssl_certificate_key /etc/nginx/ssl/xxx.com.key;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
# 日志,指定路径后可选开启。末尾值可选 error|notice|info
# error_log /var/log/nginx/xxx.com-error.log error;
sendfile off;
client_max_body_size 100m;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# 如果用到 sock 则值参考 unix:/var/run/php/php7.0-fpm.sock
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_intercept_errors off;
fastcgi_buffer_size 16k;
fastcgi_buffers 4 16k;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
百牛信息技术bainiu.ltd整理发布于博客园
Laravel 在 Nginx 中的参考配置两份的更多相关文章
- Nginx中虚拟主机配置
一.Nginx中虚拟主机配置 1.基于域名的虚拟主机配置 1.修改宿主机的hosts文件(系统盘/windows/system32/driver/etc/HOSTS) linux : vim /etc ...
- 学习计划 nginx 中 php的配置详解
本章只看一个刚下载的nginx是如何支持php的 -- location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_inde ...
- nginx中的超时配置
nginx.conf配置文件中timeout超时时间设置 client_header_timeout 语法 client_header_timeout time默认值 60s上下文 http serv ...
- Nginx中的安全配置
1.测试环境 操作系统:CentOS6.5 Web服务器:Nginx1.4.6 Php版本:Php5.4.26 2.Nginx介绍 1.nginx本身不能处理PHP,它只是个web服务器,当接收到请求 ...
- 编程技巧│超实用 nginx 中常见的配置合集
目录 封禁 IP 仅开放内网 负载均衡 列出文件列表 路由转发 开启 gzip 压缩 解决跨域 资源防盗链 Keepalived 提高吞吐量 HTTP 强制跳转 HTTPS 封禁 IP 通过 deny ...
- Nginx中超时时间配置(转)
本文介绍 Nginx 的 超时(timeout)配置.分享给大家,具体如下: Nginx 处理的每个请求均有相应的超时设置.如果做好这些超时时间的限定,判定超时后资源被释放,用来处理其他的请求,以此提 ...
- 网卡配置和DNS配置,手动挂在nas存储的共享目录,网络相关其它操作命令,修改防火墙中的端口配置,resolv.conf配置详细介绍和网卡信息配置详细介绍
1. 网卡配置和DNS配置 若想服务器能够发邮件,需要让部署的服务器能够访问到外网环境.若部署的服务器访问不到外网,通过ping www.baidu.com的方式执行的时候,会出现以下问题: &q ...
- nginx 反向代理的配置
nginx中的每个server就是一个反向代理配置,可以有多个server(nginx只能处理静态资源) nginx中 server的配置 server { listen 80; server_nam ...
- Last-Modified和ETag以及Apache和Nginx中的配置
1) 什么是”Last-Modified”? 在浏览器第一次请求某一个URL时,服务器端的返回状态会是200,内容是你请求的资源,同时有一个Last-Modified的属性标记此文件在服务期端最后被修 ...
随机推荐
- T1164 统计数字 codevs
http://codevs.cn/problem/1164/ 题目描述 Description [问题描述]某次科研调查时得到了n个自然数,每个数均不超过1500000000(1.5*109).已知不 ...
- Maven的仓库
以下内容引用自https://ayayui.gitbooks.io/tutorialspoint-maven/content/book/maven_repositories.html: 什么是Mave ...
- Liunx常用命令(备用)
常用指令 ls 显示文件或目录 -l 列出文件详细信息l(list) -a 列出当前目录下所有文件及目录,包括隐藏的a(all) mkdir ...
- iOS10你掉坑了吗?
坑1: 系统导航栏上按键消失问题 坑2: canOpenURL 调用返回NO问题 坑3: iOS10 权限崩溃问题 坑4: xib不好用了?别怕看这里! 坑5: command +/注释失效 坑6: ...
- mysql修改删除列,删除有外键依赖的列
–重命名表rename table t_softwareport to software_port; –建立外键alter table software_port add constraint fk_ ...
- 天下文章一大抄 mysql远程连接
使用GRANT命令创建远程连接mysql授权用户特定用户mysql -u root -ppassword 注意:p后面没有空格直接密码.mysql>grant all privileges ...
- 【转】利用shell命令操作Memcached
原文: 张宴的博客 —— http://zyan.cc/post/384/ -------------------------------------------------------------- ...
- java学习笔记(四)面向对象
一.形參长度可变的方法 当传入被调用的函数參数数量不确定时,在方法最后一个形參的类型后加上三个点号(...),表明该形參能够接受多个參数值.多个參数值被当做数组传入,这些參数必须为指定的类型. pac ...
- COCOS学习笔记--重力感应Acceleration
Cocos2dx重力感应Acceleration,准确来说叫加速度计,加速度计能够感应设备上X.Y.Z轴方向上线性加速度的变化.事实上叫"重力感应"或"重力加速度计&qu ...
- 锤子Smartisan T1手机官方4.4.2系统内核版本号信息
从锤子smartisan T1手机官方系统EGL中获取内核版本号信息(由cofface提供): I/Adreno-EGL( 816): <qeglDrvAPI_eglInitialize:41 ...