我在Apache服务器前inheritance了一个Nginx设置。 今天我发现了一些SQL代码打到了Apache的访问日志: GET /mgrayson/splice%27%29%20AND%20%28SELECT%204520%20FROM%28SELECT%20COUNT%28%2A%29%2CCONCAT%280x716b786b71%2C%28SELECT%20%28ELT… 在nginx中删除这种查询的最好方法是什么? 它基本上设置了一堆关键词来捕获和忽略%xx分隔符字符?: if ($query_string ~ “.*select.*from.*(“) { set $block_sql_injections 1; } 有没有更好的方法来阻止这个东西? 思考这个标准的缓解策略可能是一个长期解决的问题。 谢谢!
背景 所以昨天我正在玩我们的服务器。 在它上面我们有一个docker-compose进程,运行6个左右的容器,其中一个是Nginx。 在昨天我玩了之前,它提供的文件就好了。 我做了什么 我注意到,我可以通过运行curl -sSL https://agent.digitalocean.com/install.sh | sh来升级我的指标curl -sSL https://agent.digitalocean.com/install.sh | sh curl -sSL https://agent.digitalocean.com/install.sh | sh 。 多酷呢? 那么,我做到这一点后,奇怪的事情开始发生。 我不能确定它是因果关系,但它肯定是相关的。 我试过了 我有我的DO滴,我运行docker-compose up -d ,我得到一个: 错误:对于root_nginx_1无法启动服务nginx:驱动程序无法编程端点上的外部连接root_nginx_1:启动userland代理时出错:listen tcp 0.0.0.0:80:bind:地址已经在使用 好吧,那很奇怪… 这是工作之前,现在它甚至不会启动? 我运行ps aux -P | grep nginx ps aux -P | grep nginx看看发生了什么,并得到: root 1514 0.0 0.1 124972 1388 ? Ss 12:57 0:00 […]
我每隔几个小时就用nginx在ubuntu 16.04的访问日志中得到这两行。 有人能告诉我这是什么意思吗? 127.0.0.1 – – [01/Aug/2017:23:36:09 +0200] "POST /collect HTTP/1.0" 301 178 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36" <my external ip> – – [01/Aug/2017:23:36:09 +0200] "GET /collect HTTP/1.0" 404 564 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36"
我一直在尝试,并没有find办法做到这一点。 我正在设置一个服务器pipe理基于Web的控制面板(沿着webmin的方向),但试图添加一个非常难以欺骗的安全措施,这对访问者来说基本上是透明的,并且是空的。 我脑子里有一个想法,听起来很合适,但是对于一个真正可行的解决scheme而言,这是一个损失。 我有端口敲门设置上的SSH密钥的唯一身份validation。 攻击企图几乎为零。 我很满足于ssh安全措施,但是对nginx带来同样的安全性已经certificate是徒劳的。 是否有可能设置类似于端口敲门的东西,只有一个用户主动login到SSH有一个端口打开http? 我不能简单地使用ESTABLISHED,因为我想要求在ssh中进行身份validation。 理想的解决scheme可以这样工作… 没有ssh连接 – > DROP尝试访问nginx端口 活动的ssh连接,未经过authentication – > DROP尝试访问nginx端口 主动ssh连接,authentication – > ACCEPT nginx端口连接 我意识到终止会话会导致活动切换到DROP,这是可以接受的。 最近的解决scheme我已经能够想到通过cron扫描ssh日志并在运行中修改iptables,但是需要一个更好的方法。 如果没有其他的东西,请打开想法,指向正确的方向。 你可以编辑你的问题,给你一些关于为什么你需要这个安全级别的背景吗? 这似乎是矫枉过正。 – Tim 我提到服务器pipe理ala Webmin。 简而言之,php / py脚本可以访问服务器内部,如iptables,/ etc修改,关机/重启,日志parsing器,其他维护工具。 访问需要sudo到服务器本身,因此,希望保持它的极端保护。
我有两个子域,我想以下面的方式链接: https://suba.example.org/ : https://suba.example.org/是我的主要子域, https://subb.example.org/是我的辅助子域。 在suba我有一个服务器运行一个Web应用程序,subb只用于redirect。 suba上的这个服务器有一个url,可以叫它https://suba.example.org/foo.php/bar 。 我想要的只是,当我在浏览器中inputhttps://subb.example.org/ ,会显示https://suba.example.org/foo.php/bar的内容, 但是 URL需要说明https://subb.example.org/ 。 截至目前,它将正确显示https://suba.example.org/foo.php/bar的内容,但浏览器将显示内容的URL而不是https://subb.example.org/ 。 我重新启动了nginx-server几次,并使用隐身窗口,确保浏览器不会caching任何数据。 发生什么事是: 我在桌面上的Chrome隐身窗口中打开了https://subb.example.org/ :它将显示https://suba.example.org/foo.php/bar的正确输出, 但会显示https://suba.example.org/foo.php/bar在URL栏中 我在任何其他浏览器/机器(包括另一台机器上的Chrome隐身窗口)上打开了https://subb.example.org/ :它将显示https://suba.example.org/foo.php/bar的内容https://suba.example.org/foo.php/bar https://subb.example.org URL栏, 但只有文本,没有CSS或图片。 像80年代的网站。 在点击之前input: /imgs/Q5mgx.png : /imgs/Q5mgx.png 发生了什么: /imgs/CfHM1.png : /imgs/CfHM1.png 应该发生什么: /imgs/5OxQ4.png : /imgs/5OxQ4.png 任何帮助表示赞赏。 附件是我的nginx site-config的subb : server { listen 443 ssl; root /config/www; index index.html index.htm index.php; ### Server […]
我已经创build并启用了以下configuration: server { listen 80; listen [::]:80; root /home/ubuntu/www/storage; index index.html index.htm index.nginx-debian.html; server_name cdn.example.com; location / { autoindex on; autoindex_exact_size off; autoindex_format html; autoindex_localtime on; try_files $uri /index.php$is_args$args; } rewrite ^themes/.*/(layouts|pages|partials)/.*.htm /index.php break; rewrite ^bootstrap/.* /index.php break; rewrite ^config/.* /index.php break; rewrite ^vendor/.* /index.php break; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; } […]
我刚刚为我华丽的新网站创build了一个API,并希望返回错误响应与相关的状态代码。 但是,我已经configuration了正常的path来使用error_page指令,我不想删除错误页面。 我有一个index.php文件,处理API和网站的所有请求。 server { listen 80; listen 443 ssl http2; server_name ~^(.+)\.flashy\.local$; root "/home/vagrant/flashy/core/www"; index index.html index.htm index.php; charset utf-8; error_page 400 /error/error-400.html; error_page 403 /error/error-403.html; error_page 404 /error/error-404.html; error_page 500 501 /error/error-500.html; error_page 502 503 504 /error/error-503.html; location ~ ^/error/error-(403|404|500|503)\.html$ { internal; root /home/vagrant/flashy; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; […]
我昨天了解了Nginx,为了更加准确,我第一次了解了以下url上的所有主题: 初始服务器设置与Ubuntu 16.04 如何在ubuntu 16.04上安装和保护mongodb 如何在Ubuntu 16.04上添加交换空间 如何在Ubuntu上备份还原和迁移MongoDB数据库 如何在ubuntu 16.04上安装Nginx 如何保护nginx与我们的encryption在Ubuntu 16.04 如何在Ubuntu 16.04上安装节点js 如何在ubuntu 16.04上设置节点js应用程序进行生产 但我仍然在这里卡住, 我在哪里 我正在编辑这个Nginxconfiguration文件: /etc/nginx/sites-available/default server { listen 80 default_server; listen [::]:80 default_server; root /var/www/html; server_name mysite.mydomain.com; ssl_dhparam /etc/ssl/certs/dhparam.pem; location / { proxy_pass http://localhost:8080; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen 443 […]
我用一个$ schemetesting了proxy_cache_key proxy_cache_key $scheme; proxy_pass http://127.0.0.1:8081/; 然后我请求一个caching。 curl http://127.0.0.1:8080/a.html 然后我再次请求确认caching curl http://127.0.0.1:8080/a.html 没问题 然后我请求其他url curl http://127.0.0.1:8080/b.html 并希望它击中caching,因为密钥是$计划 但它给了我b.html的内容 为什么proxy_cache_key $scheme; 不起作用?
我以http://host.example/foo/或http://host.example/foo//的格式收到请求。请求通过proxy_pass http://backend;发送到后端服务器proxy_pass http://backend; 并使用密钥proxy_cache_key "$scheme://$host$uri$is_args$args" 。然后,后端决定应该用多个斜杠进行操作。 但是,如果/ foo //redirect到/ foo /,则使用与/ foo /相同的caching键保存该条目,从而导致redirect循环。 现在我当然有了merge_slashes on; 我想保留,因为有几个位置匹配,没有它会变得复杂。 有没有像$unmerged_uri proxy_cache_key这样的proxy_pass和proxy_cache_key会匹配?