0

I want to build and test my website on my Arch Linux computer.

The contents of the website, including index.html, are in /srv/http/myproject/.

/etc/nginx/sites-available/myproject.conf looks like this...

server {
        listen 80;
        listen [::]:80;
        root /srv/http/myproject;
        index index.html index.htm;
        server_name myproject.local;

   location / {
       try_files $uri $uri/ =404;
   }    
}

UPDATE: I had already ran ln -s /etc/nginx/sites-available/myproject.conf /etc/nginx/sites-enabled/myproject.conf.

And /etc/hosts has this...

127.0.0.1 myproject.local

But when I navigate to http://myproject.local/, all I see is the "Welcome to nginx" page.

Username
  • 153
  • 1
  • 4
  • 13

3 Answers3

4

You have to enable the website.

ln -s /etc/nginx/sites-available/myproject.conf /etc/nginx/sites-enabled/myproject.conf

And the ofcourse, restart/reload nginx.

Orphans
  • 1,404
  • 17
  • 26
2

How about just 127.0.0.1 myproject.local in the /etc/hosts? In my experience it would not necessary the semicolon in the end of line

cmj
  • 19
  • 2
1

I needed to include include /etc/nginx/sites-enabled/*; in the http block of /etc/nginx/nginx.conf.

Username
  • 153
  • 1
  • 4
  • 13