Welcome! Log In Create A New Profile

Advanced

NGINX Newbie, already in trouble (I'm TRYING to do it by the book, but ...)

Posted by JRWoodward 
NGINX Newbie, already in trouble (I'm TRYING to do it by the book, but ...)
July 24, 2019 03:02AM
Some yeas ago, I managed a FreeBSD/Apache website for a losing political campaign. I was subsequently offered MANY low-paying server admin and webmaster jobs by LOTS of losing politicians. I can claim a modest level of expertise in LAMP/XAMP operations.
I am now learning NGINX, which appears to me because of it's emphasis on security. (My new computer is an OpenBSD box.) I started with the Beginners Guide. NGINX runs properly. I suppose I should be grateful for that. But the first exercise in the Guide, Serving Static Content, has me bogged down. As instructed, I took nginx.conf and commented out all the existing servers. I think I put in just what the book ordered:
http {
server {

location / {
root /data/www;
}
location /images/ {
root /data;
}
}
}


I then set up /data/www/ and /data/images. For the html in /data/www, I copied over the index.htm file in /var/www/html - the "Welcome to NGINX" page.

No other web server is running.

For some reason, nginx can't find /data/www. curl localhost produces
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.14.2</center>
</body>
</html>
If I access the website from another computer on my LAN, I get a 404 error. At least I know nginx is running. After I couldn't find the right file a few times, I cut and pasted the text out of the Beginners Guide, which left me in the exact same place.

Any help is welcome.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 183
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready