我正在尝试在我的 Ubuntu机器上设置Madsonic并在它前面运行 Nginx。问题是,当我尝试通过 Web 界面上传内容时,我不断收到此警告:
31115#0: *14 a client request body is buffered to a temporary file
Run Code Online (Sandbox Code Playgroud)
这也解释了为什么上传窗口上的进度条不起作用。这是我的相关 Nginx 配置:
# proxy the madsonic server here
location / {
proxy_pass https://madsonic-server/;
proxy_redirect off;
proxy_buffering off;
proxy_request_buffering off;
allow all;
proxy_http_version 1.1;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto $scheme;
client_body_buffer_size 0;
client_max_body_size 0;
proxy_max_temp_file_size 0;
proxy_read_timeout 18000;
proxy_send_timeout 18000;
gzip off;
}
Run Code Online (Sandbox Code Playgroud)
我目前使用的是 Nginx 1.9.12。
我想要实现的是让 Nginx 根本不使用请求正文缓冲区, …
我的意图:我想覆盖/etc/nginx/nginx.conf(在 debian 8 中)中定义的默认配置。这个想法是保持这个文件完全不变,以简化未来的系统更新,并能够获得我没有覆盖的选项的最新更改。
我做了什么:我/etc/nginx/conf.d/以与其他几个 debian 服务相同的方式创建了一个自定义配置。
问题:但是,似乎无法覆盖某些配置,因为我收到“X”指令重复错误。Nginx 似乎不像其他服务那样支持配置覆盖。
问题:有没有办法在不获取指令重复错误的情况下覆盖和添加新选项到 nginx http上下文?或者我应该完全放弃这个想法并横冲直撞?nginx.conf
非常感谢您的帮助。
这个类似的问题并没有真正解决我的问题,因为我也想从 nginx 自动为我设置的默认选项中获利(例如worker_processes auto;)
我能够安装和运行 nginx 和乘客,但是每当我重新启动服务器时,我都无法启动 nginx。要启动 nginx 进程,我只需输入sudo /opt/nginx/sbin/nginx。根据我的理解,我在 /etc/init.d 中使用 ubuntu hardy 放入的任何内容都将被执行。有谁知道模仿这个命令行调用的命令?
须藤 /opt/nginx/sbin/nginx
nginx 0.8.35 2010 年 4 月 1 日的变化
Run Code Online (Sandbox Code Playgroud)*) Change: now the charset filter runs before the SSI filter. *) Feature: the "chunked_transfer_encoding" directive.
这很棒,因为我正在尝试通过 nginx 反向代理将 git 更改推送到 git-http-backend 进程。出于客户端效率原因, Git HTTP 利用分块传输编码。
但是,我无法让它工作。我在 Debian Lenny 上使用 nginx 0.8.44 并使用以下配置调用:
./configure \
--sbin-path=/usr/sbin \
--conf-path=/etc/nginx/nginx.conf \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--user=www-data \
--group=www-data \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--with-http_ssl_module \
--with-http_gzip_static_module \
--with-http_realip_module
Run Code Online (Sandbox Code Playgroud)
以及以下配置文件:
server {
server_name example.com;
location / {
proxy_pass http://192.168.0.10; …Run Code Online (Sandbox Code Playgroud) 我有一个这种类型的网址:
http://www.example.com/?param1=val1¶m2=¶m3=val3¶m4=val4¶m5=val5
Run Code Online (Sandbox Code Playgroud)
我想将它重定向到这个:
http://www.example.com/newparam/val3/val4
Run Code Online (Sandbox Code Playgroud)
所以我尝试了这个重写规则但没有成功:
rewrite "/?param1=val1¶m2=¶m3=(.+)¶m4=(.+)¶m5=(.+)" http://www.example.com/newparam/$1/$2 redirect;
Run Code Online (Sandbox Code Playgroud)
nginx 不能处理查询参数吗?
编辑:我不想重写所有请愿书。我只需要重写那个 URL,而不影响其他 URL。
我想配置服务器以在它存在时显示维护页面。我试过这个代码并且工作:
location / {
try_files /maintenance.html $uri $uri/ @codeigniter;
}
Run Code Online (Sandbox Code Playgroud)
但我注意到它会带有 200 状态代码,这可能会给搜索引擎造成混乱。我认为最好的做法是返回 503 状态代码。在谷歌上,我找到了几个关于它的相关页面,就像这样。但是,他们使用 if 进行重定向,并且根据 nginx 文档,使用 ifs 是不安全的。
有没有办法不使用if来做到这一点?在这种情况下使用是否安全?
谢谢。
我知道您可以使用nginx HttpGzipModule来 gzip响应。您是否也可以使用它来启用 nginx 处理 gzip 压缩的请求,即具有请求标头的请求:Content-Encoding: gzip?
注意:Apache 借助mod_deflatecan 处理带有指令的 gzip 压缩请求SetInputFilter DEFLATE。
我用 Nginx 的 Auth_Basic 模块保护了一个 web 文件夹。问题是,我们可以尝试多个密码直到它起作用(暴力攻击)。有没有办法限制失败的重试次数?
我的代理服务器在 ip A 上运行,这就是人们访问我的 Web 服务的方式。nginx 配置将重定向到 ip B 上的虚拟机。
对于 IP A 上的代理服务器,我的站点中有此可用
server {
listen 443;
ssl on;
ssl_certificate nginx.pem;
ssl_certificate_key nginx.key;
client_max_body_size 200M;
server_name localhost 127.0.0.1;
server_name_in_redirect off;
location / {
proxy_pass http://10.10.0.59:80;
proxy_redirect http://10.10.0.59:80/ /;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
rewrite ^(.*) https://$http_host$1 permanent;
server_name localhost 127.0.0.1;
server_name_in_redirect off;
location / {
proxy_pass http://10.10.0.59:80;
proxy_redirect http://10.10.0.59:80/ /;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; …Run Code Online (Sandbox Code Playgroud) 我只需要将http://shop.test.com重定向 到 http://www.test.com/fedex-orders/
就主页。没有其他的。即 http://shop.test.com/?page=blog不应重定向。