我正尝试使用netcat连接到端口80上运行在本地主机上的Nginx服务器。 但是,尽pipe我发送了任何头文件(GET,POST,HEAD),但我总是收到相同的错误页面。 有人能解释我为什么吗? pradeep@pradeep-laptop:~$ echo -n "GET / HTTP/1.0\r\n\r\n" | nc localhost 80 <html> <head><title>400 Bad Request</title></head> <body bgcolor="white"> <center><h1>400 Bad Request</h1></center> <hr><center>nginx/1.1.19</center> </body> </html> 我正在运行上面的命令,但仍然我正在获取HTML页面。 pradeep@pradeep-laptop:~$ echo -n "HEAD / HTTP/1.0\r\n\r\n" | nc localhost 80 <html> <head><title>400 Bad Request</title></head> <body bgcolor="white"> <center><h1>400 Bad Request</h1></center> <hr><center>nginx/1.1.19</center> </body> </html> 我也检查了我的nginx服务器是否正在运行或不使用netstat命令。 输出如下: root@pradeep-laptop:/# netstat -taupen| grep LISTEN […]
我试图在一个新的CentOS 6.3盒子上安装一个PHP-FPM Chroot监狱。 我可以让chroot正常工作,从这个意义上说,我可以让PHP脚本来回应和回应。 但是,每次我使用datefunction,我得到一个错误,说时区数据库已损坏。 我所做的只是将php-fpm conf中的chroot指令的值更改为nginx中指定的文档根目录。 这是testing脚本: https://gist.github.com/3199578 这是nginx的虚拟主机 https://gist.github.com/3199552 这是我到本地主机时得到的输出 https://gist.github.com/3199602
我想要做的是代理请求从http://example.com/proxy/foo到http://localhost:8060/foo 这个configuration代理http://example.com/proxy/foo到http://localhost:8060/proxy/foo server { server_name example.com; location /proxy/ { proxy_pass http://localhost:8060; } location / { proxy_pass http://localhost:8040; } }
我已经将我的博客从wordpress迁移到Octopress ,并从一个域名迁移到另一个域名。 我想创build从旧网页到新网页的重写(旧的结构是http://domain.old/?p = number )。 我为此创build了服务器块,其中包含: server { listen 80; listen [::]:80; server_name .domain.old; rewrite .*p=1$ https://domain.new/2011/rebirth/ permanent; rewrite .*p=11$ https://domain.new/2011/travelling-salesman-problem/ permanent; rewrite .*p=14$ https://domain.new/2011/minecraft-classic-client-with-fly-ability/ permanent; # rewrite ^ https://domain.new permanent; } 如果我取消注释最后一个string,我得到https://domain.new/p=14 http://domain.old/p=14请求。 如果它被注释掉,我得到一些nginx的欢迎消息,但没有redirect。 我没有想法。 任何帮助赞赏。 我目前的nginxconfiguration 。
是的,我知道还有很多其他问题看起来完全一样。 我想我一定都看过了。 两次。 在绝望中,我添加另一个以防我的具体configuration是问题。 忍受着我。 首先,问题:我需要做些什么来获得gzip压缩的工作? 我安装了运行nginx 1.1.19的Ubuntu 12.04服务器。 Nginx安装了以下软件包: nginx nginx-common nginx-full 我的nginx.conf的http块如下所示: http { include /etc/nginx/mime.types; access_log /var/log/nginx/access.log; sendfile on; keepalive_timeout 65; tcp_nodelay on; gzip on; gzip_disable "msie6"; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; } PageSpeed和YSlow都报告说我需要启用压缩。 我可以看到请求标头指示了Accept-Encoding:gzip,deflate,sdch ,但是响应头没有必然的Content-Encoding标头。 我已经尝试了各种其他configuration值( gzip_vary on , gzip_http_version 1.0等),但没有喜悦。 据我所知,我只能假设nginx是用压缩支持编译的,但是如果有什么办法可以validation的话,我很想知道。 如果有人看到我失踪的东西或可以build议进一步的debugging,请让我知道。 我不是系统pipe理员,我是Nginx的新手,所以我已经耗尽了所有我能想到或已经阅读的内容。 谢谢。
我刚把我的PHP版本从5.3.x升级到5.4.x,因为这样做 – 内存已经下降了很多! – 但是,我不断得到这些在我的php5-fpm.log: [18-Sep-2012 15:11:34] WARNING: [pool www] child 8981 exited on signal 11 (SIGSEGV – core dumped) after 65.813370 seconds from start [18-Sep-2012 15:11:34] NOTICE: [pool www] child 8988 started [18-Sep-2012 15:12:09] WARNING: [pool www] child 8988 exited on signal 11 (SIGSEGV – core dumped) after 35.185071 seconds from start [18-Sep-2012 15:12:09] […]
如何可以拒绝对一个文件夹的访问,但除了其中的一些子文件夹“拒绝”? 我尝试了这样的(按此顺序): #这个子文件夹不应该被拒绝,PHP脚本里面应该是可执行的 位置〜/ data / public {allow all; } #这个文件夹包含许多应该被拒绝公开访问的子文件夹 位置〜/数据{全部否认; 返回404; } …哪个不能正常工作 / data / public文件夹中的文件是可访问的(其他所有in / data被拒绝,因为它应该是这样),但PHP文件不再执行在/ data / public文件夹中(如果我不添加这些限制,PHP文件是可执行的)。 哪里不对? 怎么可能是正确的? 我认为这是一个更好的方法来做到这一点。 这将是非常好的,如果有人可以帮助我这个:)。 谢谢,但PHP文件仍然没有在/ data / public /文件夹中执行,就像一个简单的 <? echo "test"; ?> 它给你这个文件作为下载(没有上面的“拒绝”configuration,PHP文件运行良好)。 我的PHPconfiguration: location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; fastcgi_index index.php; include fastcgi_params; } / data /之外的所有其他目录中的PHP文件正在工作…(其他子文件夹也是如此)。
有没有办法让nginx在Windows 2003服务器上的端口80上运行? 看来,http.sys服务运行在端口80上,这是一个Web服务器在Windows上运行的新的“首选方式”,但是Nginx和Apache还没有使用它。 有没有简单的方法来阻止这个? 当我尝试绑定到port80我得到以下内容: nginx:[emerg] bind()为0.0.0.0:80失败(10013:试图以禁止其访问权限的方式访问套接字) netstat显示 Proto Local Address Foreign Address State PID TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4 那个pid是 C:\nginx-1.2.5>tasklist /svc /FI "PID eq 4" Image Name PID Services ========================= ======== ============================================ System 4 N/A
在nginx.conf中设置worker_rlimit_nofile值是否足够解决nginx中Too many open files的问题? 还是我仍然需要更新sysctl.conf和limits.conf ?
我想在FreeBSD上使用nginx上的asynchronousIO。 我看到很多关于如何configuration它或者如何编译nginx的文档。 不过,我已经安装了nginx,所以我需要重新编译启用aio的nginx。 重新编译的部分是我不知道该怎么做的。 我正在使用FreeBSD 8提供的nginx(v0.7.67)端口。 有谁能够帮助我?