AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-126898

lulalala's questions

Martin Hope
lulalala
Asked: 2013-08-02 00:00:01 +0800 CST

Nginx:使子域根本不接受 ssl 请求

  • 0

以前,当我的网站根本没有 SSL/https 时,尝试访问它会失败。例如, curl 将返回:

curl: (7) couldn't connect to host

现在我已经在子域中实现了 SSL,我想在所有其他域中模拟以前的行为。

例如:我的https://api.example.com按预期工作。但是现在访问https://www.example.com会返回 403。

# HTTPS server
server {
  listen 443;
  server_name api.example.com:

  ssl                  on;
  ssl_certificate      server.crt;
  ssl_certificate_key  server.key;

  ssl_session_timeout  5m;

  ssl_protocols  SSLv2 SSLv3 TLSv1;
  ssl_ciphers  HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers   on;

  location / {
    proxy_set_header  X-Real-IP  $remote_addr;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_redirect off;

    proxy_pass http://app;
  }
}

server {
  listen 443 default_server;
  server_name _;

  ssl                  on;
  ssl_certificate      server.crt;
  ssl_certificate_key  server.key;

  ssl_session_timeout  5m;

  ssl_protocols  SSLv2 SSLv3 TLSv1;
  ssl_ciphers  HIGH:!aNULL:!MD5;
  ssl_prefer_server_ciphers   on;

  deny all;
}

我应该如何配置 Nginx,所以访问不应该有 SSL 的子域(https://www.example.com),它会表现得好像主机无法连接?

nginx
  • 1 个回答
  • 87 Views
Martin Hope
lulalala
Asked: 2012-10-26 19:15:01 +0800 CST

Apache Benchmark 是否允许每个请求之间有间隔?

  • 3

我有一个阻止突发请求的服务器(如果同一 IP 地址每秒访问服务器超过 3 次,它将提供 500 错误)。

因此,当我使用 Apache 基准测试时,即使我将并发设置为 1,我也会看到很多失败的请求。

是否可以选择设置每个请求之间的间隔?或者是否有提供此间隔功能的类似基准测试工具?

benchmark
  • 5 个回答
  • 8699 Views
Martin Hope
lulalala
Asked: 2012-07-06 20:46:32 +0800 CST

Nginx中http block的作用是什么

  • 0

我想知道 http 块在 Nginx 中的作用。我没有看到很多教程都在谈论什么时候需要使用那个块,而且很多例子根本就没有使用它。

nginx
  • 1 个回答
  • 390 Views
Martin Hope
lulalala
Asked: 2012-07-06 18:44:40 +0800 CST

静态文件服务仅在 root 是 public 下的子文件夹时才有效

  • 2

我正在尝试使用 nginx 提供静态缓存文件。目录下有index.html文件rails_root/public/cache。我首先尝试了以下配置,但不起作用:

root <%= current_path %>/public;
try_files /cache$uri/index.html /cache$uri.html @rails;

这给出错误:

[error] 4056#0: *13503414 directory index of "(...)current/public/" is forbidden, request: "GET / HTTP/1.1"

然后我尝试了

root <%= current_path %>/public/cache;
try_files $uri/index.html $uri.html @rails;

令我惊讶的是这有效。为什么我可以做后者而不是前者(因为它们指向相同的位置)

文件系统权限

文件夹的权限是:

775 public
  755 cache
    644 index.html

Rails 位于用户~目录中,因此文件夹和文件都属于用户good。nginx 的用户root用于主处理器和http每个工作处理器:

89:http      7865  0.1  0.0   8876  2624 ?        S    Jul10   0:51 nginx: worker process                        
112:root     24927  0.0  0.0   8532  1828 ?        Ss   Jun28   0:03 nginx: master process /usr/sbin/nginx -c /etc/nginx/conf/nginx.conf

我的图标位于 public/ 下,由以下内容正确提供:

# asset server
server {
  listen 80;
  server_name assets.<%= server_name %>;
  expires max;
  add_header Cache-Control public;
  charset utf-8;
  root   <%= current_path %>/public;
}

日志

对于我的工作设置:访问日志显示:

request:"GET / HTTP/1.1" 200 uri:"/index.html"
request:"GET /assets/gas/468x15_4.gif HTTP/1.1" 200 uri:"/assets/gas/468x15_4.gif"

如果我添加index nonexistent相同的目录索引禁止错误将出现在以下访问日志中:

request:"GET / HTTP/1.1" 403 uri:"/"

错误日志:

directory index of "RAILS_ROOT/current/public/cache/gas/" is forbidden, client: _IP_, server: example.com, request: "GET / HTTP/1.1", host: "gas.example.com"

更新

请查看完整的配置文件。请注意,它是完整的,上面给出的示例有点简化。

我正在使用 Nginx 1.22

ruby-on-rails nginx
  • 2 个回答
  • 2906 Views
Martin Hope
lulalala
Asked: 2012-07-05 22:42:37 +0800 CST

两个 nginx 文件可以相互影响吗?

  • 0

两个 nginx 配置文件是相互独立运行的,还是会以某种方式相互影响?

例如,我可以在两个同名的配置文件中命名上游块而不引起冲突吗?

nginx
  • 1 个回答
  • 57 Views
Martin Hope
lulalala
Asked: 2012-07-04 21:29:37 +0800 CST

如何在nginx日志中输出变量进行调试

  • 144

我正在测试 nginx 并想将变量输出到日志文件。我该怎么做以及它将转到哪个日志文件(访问或错误)。

nginx
  • 5 个回答
  • 220756 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve