server { listen 23116; # 监听的端口号 server_name localhost; # 您的域名 root /var/www/html/verify; # 设置根路径为 /var/www/html/web index index.html; # 设置默认索引文件 location / { root /var/www/html/verify; index index.html index.htm; # try_files $uri $uri/ @router; # 处理请求的方式 } #location @router{ # rewrite ^.*$ /index.html last; #} # 静态资源配置 location ~ ^/(images|javascript|js|css|flash|media|static|eot|otf|ttf|woff|svg|woof2|fonts)/{ root /var/www/html/verify; add_header Access-Control-Allow-Origin *; #过期30天,静态文件不怎么更新,过期可以设大一点,如果频繁更新,则可以设置得小一点。 expires 30d; } location ~ ^/favicon\.ico$ { root /var/www/html/verify; } if ($args ~* "select|insert|update|delete|drop|exec|script"){ return 403; } }