Categories
Linux nginx

nginx config files and virtual sites

working with web sites on a local linux machine running nginx and can be an issue.

Found an awesome site that describes this wonderfully on how to get your test site up and running quickly

1. create your test site in /var/www/mytestsite.com

2. in the /etc/nginx directory :
mytestsite.conf


  #my test site configuration file

  server {
    listen 80;
    server_name mytestsite.com;
    location / {
      root    /var/www/mytestsite.com 
      index   index.html index.htm 
    }
}

 

3. in your /etc/hosts file, add the line:


  127.0.0.1 mytestsite.com

restart nginx with a systemctl restart nginx and hopefully, you are done.

Issues I ran across:

If nginx doesnt start properly, do a sudo journalctl command

that flashes up lots of useful messages. Your nginx debugging messages will be at the very bottom of the list.  I get there by doing a SHIFT-G.

You should see something like

In my case, I forgot to end each line with a “;”

fix the issue and try again.

Categories
debian nginx

Debian 10: Nginx is cool.

Just switched from fedora to debian.

also made the change from apache to nginx.

This is about www-data.

I found that setting my /var/www/{project}  with group of www-data and setting the directory to 755, that is good enough to run with.