加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

Laravel 5.5官方推荐的Nginx配置学习教程

发布时间:2020-12-14 20:03:45 所属栏目:大数据 来源:网络整理
导读:前言 本文主要给大家介绍了关于Laravel 5.5官方推荐的Nginx配置的想内容,分享出来供大家参考学习,下面话不多说,来一起看看详细的介绍把。 Laravel 5.5 版本官方放出了 Nginx 服务器的配置,中文文档: add_header X-Frame-Options "SAMEORIGIN"; add_head

前言

本文主要给大家介绍了关于Laravel 5.5官方推荐的Nginx配置的想内容,分享出来供大家参考学习,下面话不多说,来一起看看详细的介绍把。

Laravel 5.5 版本官方放出了 Nginx 服务器的配置,中文文档:

add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";

index index.html index.htm index.php;

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; }

error_page 404 /index.php;

location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

location ~ /.(?!well-known).* {
deny all;
}
}

自己并不擅长 Nginx,相信很多朋友跟我一样,让我们一起学习下 Nginx 的相关知识 : )

1. add_header X-Frame-Options "SAMEORIGIN";

X-Frame-Options 响应头是用来给浏览器指示允许一个页面可否在 ,