小编Bil*_*ill的帖子

Nginx 配置 - 服务 index.html 不起作用

我不知道如何重定向/index.html. 我已经浏览了 serverfault 上的线程,我想我已经尝试了所有建议,包括:

  • 重写里面的语句 location /
  • index index.htmlserver级别、location /静态内容内和静态内容内
  • node.js委托书移至location ~ /i而不是内部location /

显然,我的配置中的其他地方出了问题。这是我的 nginx.conf:

worker_processes  1;

pid        /home/logs/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include            mime.types;
    default_type       application/octet-stream;
    sendfile           on;
    keepalive_timeout  65;

    error_log   /home/logs/error.log;
    access_log  /home/logs/access.log combined;

    include sites-enabled/*;
}
Run Code Online (Sandbox Code Playgroud)

和我的服务器配置位于启用站点

server {
  root        /home/www/public;
  listen      80;
  server_name localhost;

  # proxy request to node
  location / {
    index index.html index.htm;
    proxy_set_header   Host             $http_host; …
Run Code Online (Sandbox Code Playgroud)

nginx

7
推荐指数
1
解决办法
3万
查看次数

标签 统计

nginx ×1