当前位置:网站首页>Laravel pagoda security configuration
Laravel pagoda security configuration
2022-06-24 23:12:00 【Wang Daochang's way of programming】
One 、 Site directory security :
Prevent cross station attack (open_basedir)
Write access logs
Two 、web The configuration file
server{
listen 8080;
server_name laravel.test;
index index.php index.html index.htm default.php default.htm default.html;
root /www/wwwroot/laravel/public;
# Error page configuration , Note that 、 Delete or modify
#error_page 404 /404.html;
#error_page 502 /502.html;
#PHP-INFO-START PHP Reference configuration , You can annotate or modify
include enable-php-73.conf;
#URL rewrite , After modification, the pseudo-static rules set by the panel will be invalidated
#include /vhost/rewrite/xiaobai.test.conf;
# Forbidden files or directories
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md){
return 404;
}
# One click application SSL Certificate validation directory related settings
location ~ \.well-known{
allow all;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
error_log off;
access_log /dev/null;
}
location ~ .*\.(js|css)?$ {
expires 12h;
error_log off;
access_log /dev/null;
}
access_log /www/wwwlogs/xiaobai.test.log;
error_log /www/wwwlogs/xiaobai.test.error.log;
}
enable-php-73.conf
location ~ [^/]\.php(/|$){
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi-73.sock;#php-cgi monitor
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;
}
# General configuration
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;#php-fpm monitor
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
fastcgi.conf
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
pathinfo.conf
set $real_script_name $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {
set $real_script_name $1;
set $path_info $2;
}
fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;
fastcgi_param SCRIPT_NAME $real_script_name;
fastcgi_param PATH_INFO $path_info;
3、 ... and 、 Pseudostatic
/www/server/panel/vhost/rewrite/xiaobai.test.conf
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# or
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}
Four 、 Anti theft chain

边栏推荐
- China solar window market trend report, technical dynamic innovation and market forecast
- Learn more about redis' eight data types and application scenario analysis
- 力扣解法汇总515-在每个树行中找最大值
- Solution to the login error of tangdou people
- Docker installation MySQL simple without pit
- Spark 离线开发框架设计与实现
- JD 618 conference tablet ranking list announced that the new dark horse brand staff will compete for the top three, learning from Huawei, the leader of domestic products
- Parental delegation mechanism
- laravel用户授权
- 2022 safety officer-b certificate examination question bank and answers
猜你喜欢

Epics record reference 2 -- epics process database concept

2022年安全员-A证考题及答案

Tech Talk 活动回顾|云原生 DevOps 的 Kubernetes 技巧

花房集团二次IPO:成于花椒,困于花椒

canvas 实现图片新增水印

23研考生注意啦!备考期间最容易中招的骗局,居然是它们?!

How to submit the shopee opening and settlement flow?

Dynamic menu, auto align

Solve the problem of non secure websites requesting localhost to report CORS after chrome94

【nvm】
随机推荐
Financial management [2]
加分利器 不负所托 | 知道创宇获攻防演练防守方感谢信!
What kind of processor architecture is ARM architecture?
Do you need to improve your code reading ability? It's a trick
Solve the problem of port occupation
Construction equipment [5]
从客户端到服务器
. Net 7 Preview 1 has been officially released
Docker installation redis- simple without pit
Blogs personal blog project details (servlet implementation)
Learn more about redis' eight data types and application scenario analysis
EPICS记录参考3 -- 所有记录都有的字段
Spark 离线开发框架设计与实现
vulnhub DC: 2
EMI的主要原因-工模电流
监听 Markdown 文件并热更新 Next.js 页面
Research Report on market supply and demand and strategy of China's solar charging controller industry
【基础知识】~ 半加器 & 全加器
Laravel 认证模块 auth
并发之共享模型管程