I'm not sure where to start with this since web server configuration is something that I only do to fix something else I am working on. I installed nginx on a raspberry pi to do some simple development work. I have 3 files in /etc/gninx/sites-available that are also symlinked to /etc/nginx/sites-enabled. They have straight forward setup at the moment.

Example.com has the following:

server {
    listen 80;

    root /var/www/example.com;
    server_name example.com;
    location / {
        try_files $uri $uri/ =404;

The other 2 websites have the same setup except that the root directory and the server_name are different.

I have the /etc/hosts file updated on the local machine so that when I use the browser to example.com or any of the other 2 websites, there isn't an issue finding the website. However, they all show the default debian nginx page.

The nginx.conf has the following:

    user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
    worker_connections 768;
    # multi_accept on;

http {

    # Basic Settings

    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    # server_tokens off;

     server_names_hash_bucket_size 64;
    # server_name_in_redirect off;

    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    # SSL Settings

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    # Logging Settings

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log;

    # Gzip Settings

    gzip on;
    gzip_disable "msie6";

    # gzip_vary on;
    # gzip_proxied any;
    # gzip_comp_level 6;
    # gzip_buffers 16 8k;
    # gzip_http_version 1.1;
    # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

    # Virtual Host Configs

#   include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
error_log /var/log/nginx/error.log warn;

Since I'm new to nginx I am not sure what I'm doing, or more importantly, what I may be missing. What I have found on the 'net so far is misleading and points to the same stuff I have already done.


If you are trying to search for "VirtualHost *:80" tags in nginx configuration file then my answer is that you won't find it. VirtualHost is used in apache server. In nginx it is represented by "server { listen 80;"

  • I meant virtual host as an idea, not a configuration tag. In this case I guess it is server blocks. – new2code May 2 at 12:43
  • Sadly, while I was never able to find a fix for this, the answer ended up being that I install apache and setup virtual hosts. – new2code May 5 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.