Laravel项目的nginx配置示例

server {
    listen 80;
    server_name *.adebug.com;
    root /www;

    add_header X-Frame-Options "SAMEORIGIN";     #不允许被本域以外的页面嵌入
    add_header X-XSS-Protection "1; mode=block"; #XSS保护配置
    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:/tmp/php72-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

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

发表评论

电子邮件地址不会被公开。 必填项已用*标注