1

Apologies in advance. I'm a beginner with Nginx and have a lot to learn with server administration. After doing a bunch of searching and reading, I'm really not understanding a direct solution to my problem.

With Nginx I have the following URL that awkwardly shows the filepath on my server and the .html extension:

bwillis.info/artifact/faeriefm/faerieFM.html

I'd simply like to be able to access that page with:

bwillis.info/faeriefm

How can I accomplish this? It's my understanding that I'd use the "rewrite" function. But I'm having trouble breaking down and making sense of the syntax on the examples here:

http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite

Folder Structure:

index.html sits at the root

Four pages sit one folder deep in folder called "artifact" so: bwillis.info/artifact/samplepage.html

One additional page, the one I used in the example, sits one more folder deep inside the "faeriefm" folder. so: bwillis.info/artifact/faeriefm/faerieFM.html

Server Configuration File:

server {
    listen 80;
    listen [::]:80;

    root /var/www/bwillis.info/html;
    index index.html index.htm index.nginx-debian.html;

    server_name bwillis.info www.bwillis.info;

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.