Laravel 5.5官方推荐的Nginx配置学习教程
来源:
中文源码网 浏览:186 次 日期:2024-04-11 14:55:14
【下载文档: Laravel 5.5官方推荐的Nginx配置学习教程.txt 】
Laravel 5.5官方推荐的Nginx配置学习教程
前言
本文主要给大家介绍了关于Laravel 5.5官方推荐的Nginx配置的想内容,分享出来供大家参考学习,下面话不多说,来一起看看详细的介绍把。
Laravel 5.5 版本官方放出了 Nginx 服务器的配置,中文文档:服务器配置 Nginx
server {
listen 80;
server_name example.com;
root /example.com/public;
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 响应头是用来给浏览器指示允许一个页面可否在
,