whcoding whcoding
首页
归档
关于
GitHub (opens new window)
首页
归档
关于
GitHub (opens new window)
  • ngxin

    • nginx 常用配置
      • 给你的网站免费配置 https
      • 更改 nginx php-fpm 运行用户
      • Nginx 设置允许跨域
    • Nginx
    • ngxin
    whcoding
    2021-04-26
    目录

    nginx 常用配置

    # 跨域

     add_header Access-Control-Allow-Origin "*";
     add_header Access-Control-Allow-Methods "OPTION, POST, GET";
     add_header Access-Control-Allow-Headers "*";
    
    1
    2
    3

    # 其他

     add_header X-Frame-Options "SAMEORIGIN"; # 防跨站点脚本攻击
     add_header X-XSS-Protection "1; mode=block"; # 防止xss攻击
     add_header X-Content-Type-Options "nosniff"; # 禁用浏览器根据响应头Content-Type字段来猜测类型
    
    1
    2
    3
    #Nginx
    上次更新: 2022/08/30, 23:31:20
    给你的网站免费配置 https

    给你的网站免费配置 https→

    Theme by Vdoing | Copyright © 2018-2023
    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式