server blocks configured, but getting "hello world" of nginx

Josh Stratton strattonbrazil at gmail.com
Sun Feb 2 17:14:03 UTC 2014


I've followed the tutorial below to setup a couple of server blocks, but I
get the "Welcome to nginx" message every time.

https://www.digitalocean.com/community/articles/how-to-set-up-nginx-virtual-hosts-server-blocks-on-ubuntu-12-04-lts--3

$ ls -l /etc/nginx/sites-available/
total 8
-rw-r--r-- 1 root root 1185 Feb  2 17:01 morebearsmore.com
-rw-r--r-- 1 root root 2744 Feb  2 17:07 strattonbrazil.com

$ ls -l /etc/nginx/sites-enabled/
total 0
lrwxrwxrwx 1 root root 44 Feb  2 17:03 morebearsmore.com ->
/etc/nginx/sites-available/morebearsmore.com
lrwxrwxrwx 1 root root 45 Feb  2 16:44 strattonbrazil.com ->
/etc/nginx/sites-available/strattonbrazil.com

This is the contents of more of the configs (minus the comments at the
top).

server {
listen 80;
listen [::]:80 default_server ipv6only=on;

    root /var/www/morebearsmore.com/public_html;
index index.html index.htm;


# Make site accessible from http://localhost/
server_name morebearsmore.com;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
 try_files $uri $uri/ /index.html;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
 }

location /doc/ {
alias /usr/share/doc/;
 autoindex on;
allow 127.0.0.1;
allow ::1;
 deny all;
}

}

I've added a "hello world" index file to that directory, too.

$ ls -l /var/www/strattonbrazil.com/public_html/index.html
-rw-r--r-- 1 root root 148 Feb  2 16:41 /var/www/
strattonbrazil.com/public_html/index.html

$ cat /var/www/strattonbrazil.com/public_html/index.html
<html>
  <head>
    <title>www.strattonbrazil.com</title>
  </head>
  <body>
    <h1>Success: You Have Set Up a Virtual Host</h1>
  </body>
</html>

But again every time I get the same welcome message.  Here's the access log
for hitting morebearsmore.com a few times from my web browser.  I don't see
any messages in the error log.

71.217.116.55 - - [02/Feb/2014:17:13:57 +0000] "GET / HTTP/1.1" 304 0 "-"
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Ubuntu Chromium/31.0.1650.63 Chrome/31.0.1650.63 Safari/537.36"
71.217.116.55 - - [02/Feb/2014:17:14:00 +0000] "-" 400 0 "-" "-"
71.217.116.55 - - [02/Feb/2014:17:14:07 +0000] "GET / HTTP/1.1" 304 0 "-"
"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Ubuntu Chromium/31.0.1650.63 Chrome/31.0.1650.63 Safari/537.36"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140202/df67b723/attachment.html>


More information about the nginx mailing list