Patrick Kirk wrote: > I am trying to run an ASP.Net Core site on my hosted Debian box and I seem > to have messed up the configuration. All attempts to reach the page on > port 80 get 403 Forbidden messages. > > My error log says: pk@debian-s-websites:~$ sudo tail -f > /var/log/nginx/error.log 2021/12/13 06:27:24 [error] 17999#17999: *675 > directory index of "/var/www/cxxxn.org/" is forbidden, client: 213.7.43.53, > server: cxxxn.org, request: "GET / HTTP/1.1", host: "www.cxxxn.org" > > If I try lynx http://localhost:5000 locally I get a perfect session. So > kestrel is working but nginx is not configured correctly. I think the > mistake is in my the config file for cxxxn.org has a line saying: "index > index.html index.htm index.nginx-debian.html" To test this, I put a > <html>Hello > World</html> file in the root folder and it was served up correctly. If I > then try http://cxxxn.org/Privacy I get a 404 error. > > Does anyone know if my guess that the "index" line in the configuration is > the problem is correct? > > How can I configure Nginx to serve content from Asp.Net Core where there is > no static html file being generated?
In /etc/nginx/site-enabled/ you need to put a config file that unambiguosly tells nginx: 1. which DNS name(s) to serve from this config 2. what ports 3. what protocols 4. If using SSL/TLS, which certs and algorithms 5. If serving static content, where to begin 6. If serving dynamic content, where to get it A program running on port 5000 is a fine place to serve dynamic content from, but you haven't told nginx about it. I'll bet you that this "kestrel" program comes with documentation about using a reverse proxy, which is what you want nginx to do. -dsr-