I'm trying to set up a simple virtual host, serving only static files. Trouble is, directing the browser to (in this case) jorum.dev
displays the default nginx welcome page, as opposed to jorum.dev/index.html
.
Nginx was installed using Homebrew on Mac OS X Mountain Lion.
127.0.0.1 jorum.dev
server { listen 80; server_name jorum.dev; location / { root ~/Sites/jorum; index index.html index.htm; } }
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; } } }
A web page saying “Welcome to nginx!” is just a diagnostics response that can be produced by any of the websites out there, running nginx web server. Currently, nginx is the 2nd most popular open source web server in the world, it's being used by over 126,000,000 (or 14% of the Internet) websites.
If you removed default under /etc/nginx/sites-available and restarted nginx and the welcome page is still showing, then see if there is a default. conf under /etc/nginx/conf. d and delete it and then restart nginx.
Looking at default configuration file in /etc/nginx/sites-available/default showed the path to be the same as the --prefix path. But the configuration file located at /etc/nginx/conf. d/default. conf listed the root as /usr/share/nginx/html.
By default Nginx Web server default location is at /usr/share/nginx/html which is located on the default file system of the Linux.
the debian/ubuntu nginx package comes with a default
sites-available that takes over the default host dispatch. Simply remove the default link and it should load your site instead.
index index.html index.htm index.nginx-debian.html;
I've had the file index.nginx-debian.html
show up in my www root directory, which took precedence over the cgi locations.
nginx has a verbose test mode that can be used to dump the entire configuration as parsed by nginx, which you can sanity check against your expectations.
nginx -T
Missing includes in nginx.conf
include /usr/local/etc/nginx/sites-enabled/*;
http://wiki.nginx.org/CoreModule#include
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With