I want to configure nginx to server HTML files for viewing instead of downloading.
server {
listen 5000;
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
#location / {
# root html;
# index index.html index.htm;
#}
location = / {
root /home/vagrant/own/base/assets;
index index.html;
}
location = /login {
# root /home/vagrant/own/base/assets;
alias /home/vagrant/own/base/assets/login.html;
}
location /index.html {
root /home/vagrant/own/base/assets;
}
}
This is my conf file, when I browse to /login
, my browser tries to offer the file for download instead of viewing it. Thanks for your help.
location = /login {
default_type "text/html";
alias /home/vagrant/own/base/assets/login.html;
}
I think the approach above is effective, there maybe other answers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With