I am new to WSL2 but so far it works really nice. I have a simple HTML Page i want to serve with Nginx, but i want it to access with a web browser on the host. The default nginx webpage works(!), so i started to mimic the default nginx html page (/var/www/html/index.html).
I have created:
/var/www/test.dev/index.html
/etc/nginx/sites-available/test.dev (+Symlink in sites-enabled/)
Nginx config:
server {
listen 9000;
listen [::]:9000;
server_name test.dev;
root /var/www/test.dev;
index index.html;
location / {
try_files $uri $uri/ =404;
}
}
So the only big difference to the default config is the port 9000.
I reloaded/restarted nginx and i tried to curl my configs:
$ curl https://localhost
$ curl https://localhost:9000
both requests were successful.
But now i want to access the pages on my Windows host with a web browser. The first one (default) works and i can see the default Nginx HTML page. The second one does not work: site can't be reached.
So my questions:
1. Why is that? Do i have to make some changes to the Windows Firewall settings?
2. I like to have a virtual host name like example.com instead of localhost:9000
I've edited /etc/hosts... it works with curl but again not in the host Browser