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-220280

barfurth's questions

Martin Hope
barfurth
Asked: 2017-01-14 03:18:22 +0800 CST

nginx 只能提供来自子目录的静态文件,而不是网站根目录(500 错误)

  • 0

我没有使用任何框架或任何东西。我试图将我的 style.css 放在与 index.html 相同的目录中(加载正常),但是当我尝试访问它时会引发 500 错误。所以https://example.com/index.html加载正常(没有样式),但访问https://example.com/style.css会引发 500 内部服务器错误。奇怪的是,如果我将样式表放入子目录中,它会起作用,因此https://example.com/styles/style.css可以正常加载。

这是我的站点配置(虚拟主机):

server {
    listen 80;
    server_name example.com www.example.com;

    location / {
        return 301 https://$host$request_uri;
    }

    location /.well-known {
        alias /usr/share/nginx/html/.well-known;
        allow 0.0.0.0;
        deny all;
    }
}

server {
    listen 443;
    server_name example.com www.example.com;

    root /home/deployer/example.com;

    ssl on;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    include includes/ssl;

    try_files $uri/index.html $uri;

    error_page 500 502 503 504 /500.html;
    client_max_body_size 4G;
    keepalive_timeout 10;
}

错误日志

2017/01/13 06:25:46 [error] 1279#0: *182 rewrite or internal redirection cycle while internally redirecting to "/style.css", client: 0.0.0.0, server: example.com, request: "GET /style.css HTTP/1.1", host: "example.com"
2017/01/13 06:25:47 [error] 1279#0: *183 rewrite or internal redirection cycle while internally redirecting to "/favicon.ico", client: 0.0.0.0, server: example.com, request: "GET /favicon.ico HTTP/1.1", host: "example.com", referrer: "https://example.com/style.css"

访问日志

0.0.0.0 - - [13/Jan/2017:06:25:46 -0500] "GET /style.css HTTP/1.1" 500 603 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"
0.0.0.0 - - [13/Jan/2017:06:25:47 -0500] "GET /favicon.ico HTTP/1.1" 500 603 "https://example.com/style.css" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36"
virtualhost nginx css
  • 1 个回答
  • 2352 Views
Martin Hope
barfurth
Asked: 2014-08-18 14:56:21 +0800 CST

在 Ubuntu 服务器启动时拉取 GitHub 存储库

  • 2

我有一个自动缩放 EC2 组,并且我有一个在服务器之间使用 git 的中央配置。它们设置有密钥,因此不需要密码。

我想确保当一个实例从 AMI 启动和创建(具有可能过时的配置)时,它使用普通的 git pull 命令提取配置。该命令必须以特定用户身份执行,因为只有该用户可以 git pull 因为它是在其主目录中具有 RSA 密钥的用户。

所以基本上在服务器启动时,某个用户需要在某个存储库中运行 git pull。

ubuntu
  • 1 个回答
  • 784 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