我正在尝试设置一个简单的虚拟主机,只提供静态文件。麻烦的是,将浏览器定向到(在这种情况下)jorum.dev
显示默认的 nginx 欢迎页面,而不是jorum.dev/index.html
.
Nginx 是在 Mac OS X Mountain Lion 上使用 Homebrew 安装的。
主机
127.0.0.1 jorum.dev
jorum.dev
server {
listen 80;
server_name jorum.dev;
location / {
root ~/Sites/jorum;
index index.html index.htm;
}
}
nginx.conf
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
gzip_disable "msie6";
gzip_min_length 1100;
gzip_vary on;
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/rss+xml text/javascript image/svg+xml application/x-font-ttf font/opentype application/vnd.ms-fontobject;
server_tokens off;
client_max_body_size 4096k;
client_header_timeout 10;
client_body_timeout 10;
keepalive_timeout 10 10;
send_timeout 10;
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}