-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: added nginx deployment documentation #3770
Conversation
* docs: add Stormkit as deployment platform (vuejs#3751) * docs: adjust install and init commands * docs: update default-theme sidebar type (vuejs#3715) * docs: make vue as peer dependency section clearer (vuejs#3687) * fix: hashchange should only be triggered for same page navigations (vuejs#3768) * chore: bump deps, lock mdit to v2.0 * release: v1.1.0 * build: set up sort-package-json * docs: added nginx deployment documentation (vuejs#3770)
This doesn't handle the case of removing trailing slash. |
@brc-dd Yes indeed. Removing the trailing slash by redirecting also has downsides: https://blog.mehdi.cc/articles/vitepress-cleanurls-on-nginx-environment#the-trade-off-for-index-pages Using the currently described setup:
I'm currently on vacation, so I couldn't test the behavior when there is a folder (example/) along a file with the same name (example.html). This might indeed break. Did I miss a (easy) way to handle this? |
I don't think that blog post is doing things correctly. They are doing 301 redirects while vitepress explicitly states you need rewrites for cleanUrls to work (rewrites here are different than nginx rewrite directive). Rewrite basically means serving the page without doing 301/302. I'll try and update the configuration to handle that case. Basically all these cases need to be handled - https://github.com/slorber/trailing-slash-guide (the "both" test case there is ambiguous and left out to implementation. One needs to do what Netlify is doing for cleanUrls to work properly) |
Hi! Author of the article here. What I do
Actually I do both. My goal is that the user is always on the canonical (no trailing
For example, to serve the file at
(And I also want all URLs to work without JavaScript in the browser. But in a way or another, static site generators have their limits, and looking at what hosting service do, there are redirects and URL inconsistencies (user point of view) in most clean URLs scenarios. So choices have to be made and URL consistency is very important for me.) AlternativelySince I provide a
I can’t have this without first getting rid of the trailing slash with a redirect. And then it creates more issues if. More on this in next section. Testing domain and branchTo help with testing purpose, I opened a branch and a new subdomain:
When doing this:
I also tested with
(This is not the config live on the Let me know if you would like to test specific things. |
Added nginx deployment documentation as discussed in #3756 with some links for further reading.