我试图找出为什么我的 JSON 响应没有被 gzip 压缩。在我的主ngninx.conf中,我有:
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_min_length 256;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css text/html application/json application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;
Run Code Online (Sandbox Code Playgroud)
然后在我的脚本中我将内容类型打印为:
print $IN->header( 'application/json' );
Run Code Online (Sandbox Code Playgroud)
其转换为:
Content-Type: application/json \n\n
Run Code Online (Sandbox Code Playgroud)
我在那里看到正确的内容类型,它没有压缩:
curl -H "Accept-Encoding: gzip" -I 'https://www.example.com/cgi-bin/links/spots_load_new.cgi?catid=9&linkid=0&t=luna'
HTTP/1.1 200 OK
Server: nginx
Date: Thu, 07 Dec 2017 10:18:58 GMT
Content-Type: application/json
Connection: keep-alive
Keep-Alive: timeout=60
Access-Control-Allow-Origin: *
Run Code Online (Sandbox Code Playgroud)
如果我在 JS 文件上测试它,它工作正常:
curl -H "Accept-Encoding: gzip" -I …Run Code Online (Sandbox Code Playgroud) 我试图强制一个 URL 指向一个新位置。例如:
我目前在网站上设置了一个“地图”:
map $uri $is_rewrite {
default no_redirect;
include /home/xxx/conf/web/chambres.com.extra/links.map;
}
Run Code Online (Sandbox Code Playgroud)
...在该文件中,规则之一是:
/gites/ https://$http_host;
#/Gites/ https://$http_host;
/french/Gites/ https://$http_host;
Run Code Online (Sandbox Code Playgroud)
如果我取消注释第 2 行,则会出现错误!
nginx: [emerg] /home/xxx/conf/web/chambres.com.extra/links.map:107 中的参数“/gites/”冲突
当我测试它时,果然,小写的有效,但大写的“Gites”无效。我怎样才能让它不区分大小写?
我正在尝试研究如何保护 Apache 2.4 中的文件夹。
我有这部分工作正常:
AuthUserFile /home/test/web/site.com/cgi-bin/hotels/admin/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
AuthName Protected
require valid-user
Run Code Online (Sandbox Code Playgroud)
...但我还想添加允许我进入而无需登录的选项。这是我在旧服务器上的内容:
Order Deny,Allow
Deny from all
Allow from 123.123.123.123
Satisfy Any
Run Code Online (Sandbox Code Playgroud)
但新的给出了一个错误:
client denied by server configuration: /home/test/web/site.com/cgi-bin/hotels/admin/admin.cgi
Run Code Online (Sandbox Code Playgroud)
查看https://wiki.apache.org/httpd/ClientDeniedByServerConfiguration,我认为这会起作用:
Require all denied
Allow from 123.123.123.123
Satisfy Any
Run Code Online (Sandbox Code Playgroud)
...但它似乎没有(现在甚至不要求登录,即使我将接受的 IP 更改为随机 IP)
我错过了什么?
我正在尝试安装XML::Parser,但由于某种原因它失败了:
cpanm (App::cpanminus) 1.7040 on perl 5.022001 built for x86_64-linux-gnu-thread-multi
Work directory is /root/.cpanm/work/1500726452.8458
You have make /usr/bin/make
You have LWP 6.15
You have /bin/tar: tar (GNU tar) 1.28
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Searching …Run Code Online (Sandbox Code Playgroud) 我想弄清楚为什么 Perl 模块不会安装在我的服务器上。
cpanm WWW::Mechanize
Run Code Online (Sandbox Code Playgroud)
它处理了很长时间的东西,然后最终死亡:
root@admin:~# cpanm WWW::Mechanize
--> Working on WWW::Mechanize
Fetching http://www.cpan.org/authors/id/O/OA/OALDERS/WWW-Mechanize-1.90.tar.gz ... OK
Configuring WWW-Mechanize-1.90 ... OK
Building and testing WWW-Mechanize-1.90 ... FAIL
! Installing WWW::Mechanize failed. See /root/.cpanm/work/1543994046.20570/build.log for details. Retry with --force to force install it.
Run Code Online (Sandbox Code Playgroud)
日志文件中有这样的东西:
t/00-report-prereqs.t .................... ok
t/add_header.t ........................... ok
t/aliases.t .............................. ok
t/area_link.t ............................ ok
t/autocheck.t ............................ ok
t/bad-request.t .......................... ok
t/clone.t ................................ ok
t/content.t .............................. ok
# Test server http://127.0.0.1:31546 as PID 20661
t/cookies.t .............................. ok
t/credentials-api.t ...................... ok …Run Code Online (Sandbox Code Playgroud) 这是对我的另一个问题的跟进,但它完全不同,所以我想我会开始一个新帖子。
我正在尝试弄清楚为什么在添加电子邮件帐户时仍然收到此错误消息(在这种情况下,在 Thunderbird 中 - 但我在手机上也遇到了这个问题);
奇怪的是,如果我在 SSL-Tools.net 上检查它,它看起来不错:
https://ssl-tools.net/mailservers/wkingbrickwork.co.uk
我真的不明白 - 正如 Thunderbird 显示我的证书在这里过期:
我错过了什么吗?如果您需要更多信息来帮助我进行调试,请告诉我。我不确定什么会有帮助。
我想弄清楚为什么 Image::Magick 不会安装。我已经尝试了很多东西,但它仍然是致命的:
perl -MCPAN -e 'install Image::Magick'
Run Code Online (Sandbox Code Playgroud)
......它会随着:
Reading '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /root/.cpan/Metadata
Running install for module 'Image::Magick'
Fetching with LWP:
http://www.cpan.org/authors/id/J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz
Fetching with LWP:
http://www.cpan.org/authors/id/J/JC/JCRISTY/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz ok
'YAML' not installed, will not store persistent state
Configuring J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Image::Magick
Writing MYMETA.yml and MYMETA.json
JCRISTY/PerlMagick-6.89-1.tar.gz
/usr/bin/perl Makefile.PL INSTALLDIRS=site -- OK
Running make for J/JC/JCRISTY/PerlMagick-6.89-1.tar.gz
cp Magick.pm blib/lib/Image/Magick.pm
AutoSplitting blib/lib/Image/Magick.pm (blib/lib/auto/Image/Magick)
Running …Run Code Online (Sandbox Code Playgroud) 我一直在我的 nginx 和 Apache 服务器日志文件中看到以下内容为 400:
() { :; }; /bin/ping -c 3 x.x.x.x
Run Code Online (Sandbox Code Playgroud)
xxxx 是不同的 IP。这看起来像黑客试图在服务器中找到漏洞吗?我们有 IP 阻止设施,但如果它是真实的,我不想这样做。
完整的日志文件条目是:
207.150.177.200 - - [25/Sep/2015:08:51:02 +0200] "GET / HTTP/1.0" 400 226 "() { :; }; /bin/ping -c 3 82.118.236.247" "-"
Run Code Online (Sandbox Code Playgroud) perl ×3
linux ×2
nginx ×2
apache-2.4 ×1
cpan ×1
debian ×1
email ×1
gzip ×1
hacking ×1
imagemagick ×1
smtp ×1
spam ×1
ubuntu-16.04 ×1
unix ×1
xml ×1