nginx

convert nginx conf to apache conf for proxypass

社会主义新天地 提交于 2021-02-08 02:32:16
问题 I need to convert this nginx conf to apache conf. As i have tried to convert, But failed to get it. upstream apiUpstream { # 1. Set your port here server 127.0.0.1:8080; keepalive 64; } server { listen 80; listen 443 ssl; # 2. Set your API domain name here server_name yourdomain.com; location / { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # RequestHeader set X-Forwarded-Port "443" proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; proxy_http_version 1

nginx高性能WEB服务器系列之一简介及安装

五迷三道 提交于 2021-02-07 22:52:27
nginx系列友情链接: nginx高性能WEB服务器系列之一简介及安装 https://www.cnblogs.com/maxtgood/p/9597596.html nginx高性能WEB服务器系列之二命令管理 https://www.cnblogs.com/maxtgood/p/9597990.html nginx高性能WEB服务器系列之三版本升级 https://www.cnblogs.com/maxtgood/p/9598113.html nginx高性能WEB服务器系列之四配置文件详解 https://www.cnblogs.com/maxtgood/p/9598333.html nginx高性能WEB服务器系列之五--实战项目线上nginx多站点配置 https://www.cnblogs.com/maxtgood/p/9598610.html nginx高性能WEB服务器系列之六--nginx负载均衡配置+健康检查 https://www.cnblogs.com/maxtgood/p/9599068.html nginx高性能WEB服务器系列之七--nginx反向代理 https://www.cnblogs.com/maxtgood/p/9599335.html nginx高性能WEB服务器系列之八--nginx日志分析与切割 https://www.cnblogs

面试官给我挖坑:rm删除文件之后,空间就被释放了吗?

混江龙づ霸主 提交于 2021-02-07 22:44:20
在Linux,你是不是曾经天真的以为,使用rm删除一个文件,占用的空间就释放了?事情可能不是常常如人意。 产生一个指定大小的随机内容文件 我们先看一下当前各个挂载目录的空间大小: $ df -h /dev/sda11 454M 280M 147M 66% /boot 我这里挑选了其中一个结果展示(你可以选择任一挂载目录),接下来准备在 /boot 下生成一个文件。 首先我们产生一个50M大小的文件: $ dd if=/dev/urandom of=/boot/test.txt bs=50M count=1 至此,我们产生了一个50M大小的文件,再看boot下: $ df -h /dev/sda11 454M 312M 115M 74% /boot 这里你不用关心到底多了多少,你只需要关注,/boot下的文件增多了。 测试程序: #include<stdio.h> #include<unistd.h> int main(void) { FILE *fp = NULL; fp = fopen("/boot/test.txt", "rw+"); if(NULL == fp) { perror("open file failed"); return -1; } while(1) { //do nothing sleep(1); } fclose(fp); return 0; }

.htaccess doesn't escape question mark on RewriteRule

佐手、 提交于 2021-02-07 20:55:14
问题 I have a website with an old type of Single Sign On. A parent website sends users to my website with a URL like: http://test.instela.fm/index.php?gid=abcd1234&u=thedewil&id=11472 and I want to rewrite it as this: http://test.instela.fm/login/abcd1234/thedewil/11472 I have created a .htaccess file as following: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^index.php?gid=(.*)&u=(.*)&id=(.*)$ login/$1/$2/$3 [L] I tried escaping the question mark in the URL

.htaccess doesn't escape question mark on RewriteRule

社会主义新天地 提交于 2021-02-07 20:54:17
问题 I have a website with an old type of Single Sign On. A parent website sends users to my website with a URL like: http://test.instela.fm/index.php?gid=abcd1234&u=thedewil&id=11472 and I want to rewrite it as this: http://test.instela.fm/login/abcd1234/thedewil/11472 I have created a .htaccess file as following: RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^index.php?gid=(.*)&u=(.*)&id=(.*)$ login/$1/$2/$3 [L] I tried escaping the question mark in the URL

Nginx reverse proxy configuration

送分小仙女□ 提交于 2021-02-07 20:39:18
问题 I need nginx to reverse- proxy GET and POST requests of the form: /myapp/path/to/resource to: http://127.0.0.1:9090/path/to/resource I'm trying the following: location /myapp/(.*) { rewrite $1; proxy_pass http://127.0.0.1:9090; } but nginx is returning a HTTP 405 error [not allowed]. Any ideas on how to fix this ? Thanks. 回答1: You don't actually need to do a rewrite. You can achieve the same end with the following: location /myapp/ { proxy_pass http://127.0.0.1:9090/; } 来源: https:/

开发安全规范

試著忘記壹切 提交于 2021-02-07 20:28:47
本文档 涉及内容:输入验证,输出验证,身份验证,短信验证,图灵测试,密码管理,会话安全,访问控制,SQL注入,XSS注入,XML注入,敏感信息,CSRF跨站请求伪造,文件上传安全,接口安全,I/O操作安全,运行环境,异常处理,日志规范,备份,其它。 检查类型 说明 检查项 输入验证 概述 任何来自客户端的数据,如URL和参数、HTTP头部、 Javascript戓其他嵌入代码提交的信息,都属于不可信数据。在应用外部边界或内部每个组件或功能边界,都将其当做潜在的恶意输入来校验 总则 1、不信任任何输入,集中验证输入;2、不依赖客户端验证,采用服务端验证方式;3、注意标准化问题,限制、拒绝、净化输入;4、具体检测规则参考下方每个细则。 白名单 不可信数据可以设定白名单校验的,应接受所有和白名单匹配的数据,并阻止其他数据,白名单可通过验证类型、长度、格式和范围实现。 黑名单 不可信数据中包含不良输入字符时,如空字节(%00)、换行符(%0d,%0a,\r, \n)、路径字符(../ 或 ..)、特殊字符(<,>,',")等,建议直接阻止该数据,若需要接受该数据,则应做不同方式的净化处理,如html实体编码。 规范化 不可信数据的净化和校验进行规范化,如将目录遍历(./或../)等相对路径转化成绝对路径URL解码等。 净化 不可信数据需实施各种净化处理时,应彻底删除恶意字符

How do I run uWSGI as a limited-access user?

无人久伴 提交于 2021-02-07 19:17:11
问题 I have Django setup in NGINX + uWSGI. I'm able to get it running fine under my current logged in user (with help from a question I asked few days back) but now I want to run uwsgi --ini uwsgi.ini as a limited-access user . Here is what I've done so far: 1. Created a user djangouser without login access and without a home directory. 2. Added user nginx into group djangouser 3. Placed my django files into /mnt/django directory and changed file permissions of django to drwxrwx--- djangouser

Django Rest Framework metrics per user requests

情到浓时终转凉″ 提交于 2021-02-07 19:16:56
问题 I'm currently working on an Api build with Django Rest Framework, uwsgi nginx and memcached. I would like to know what is the best way to get users statistics like number of requests per user? Taking in consideration that the infrastructure is probably going to scale to multiple servers. And is there is a way to determine if the response was retrieve from cache or from the application? What I'm thinking is processing the Nginx logs to separate the request by user and apply all the