我不知道如何重定向/
到index.html
. 我已经浏览了 serverfault 上的线程,我想我已经尝试了所有建议,包括:
location /
index index.html
在server
级别、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 ×1