Hosting RTD documentation in a subfolder of existing domain - read-the-docs

I currently have documentation built by readthedocs.org on docs.mycompany.com and my regular company website on mycompany.com. For SEO purposes I would prefer to have the documentation on mycompany.com/docs, so my documentation content contributes to the company website ranking.
From the documentation on custom domains I can only find subdomain examples. Am I correct in thinking the above is not possible with readthedocs.org and would require me to start self-hosting the documentation?

Read the Docs cannot control your root domain (mycompany.com) if you have something else hosted there. You could put a reverse proxy listening at /docs on your mycompany.com domain pointing to your <project-slug>.readthedocs.io URL.

Related

Let netlify use a subdomain thats also used on a different site

(how) is this possible:
I have 2 netlify sites main-app and sub-app.
main-app has a custom domain (www.main.com).
I now want to make the 2nd site sub-app using the custom domain sub.main.com but Netlify forbids this and notes that I already use the respecity domain main.com.
Any help?
It is possible to use subdomains. It is discussed in detail in their docs: https://docs.netlify.com/domains-https/custom-domains/
You already have a Netlify subdomain where your app is hosted, of type myapp.netlify.app. Now you need to point your subdomain to this instance. If you use for example Namecheap, you do it like this: https://www.namecheap.com/support/knowledgebase/article.aspx/9776/2237/how-to-create-a-subdomain-for-my-domain/
Here is Netlify's instructions for doing this if you don't host your domain with them (aka not using Netlify DNS) https://docs.netlify.com/domains-https/custom-domains/configure-external-dns/
Similar DNS editing as in Namechrap will be seen on all other domain hosts. Once this is set up and has had time to propagate (give it 10 minutes to an hour) you proceed with hooking it up in Netlify. Your error message should now be gone.
Remember that you need different DNS records on your domain host for the main app and the sub app.
You can add a subdomain in the netlify panel and in you DNS manager / hosting provider add the records as CNAME with the domain provided by netlify.

How to host my own website with my own html documents

I know this is the most basic of questions. I made my own website in HTML documents. I bought a domain name from google. How can I publish this, how can I host it? I don't want to use any website creator, I want to publish my own files that I worked on.
You can use Github to host your website on your own domain.
You have to add the whole files needed for the website. Then in the settings of your repo use the Github pages feature and enable it. Change the source of Github pages to host in your own domain. Then you have to add some A and CNAME records of your domain to point to github servers.
Here are the full steps for the process - https://www.geeksforgeeks.org/publish-websites-on-github-pages-with-a-custom-domain/

Create a Github Pages subdomain while main domain is elsewhere

I am trying to host a custom subdomain with Github Pages.
My apex domain (http://example.com) is pointing to a custom server (not Github Pages).
I am trying to get a subdomain of this (http://subdomain.example.com) to host a Github Pages site off a project page.
I have created a CNAME record for the subdomain pointing to http://username.github.io but it comes up with this error:
Your site's DNS settings are using a custom subdomain,
subdomain.example.com, that's set up as an A record. We
recommend you change this to a CNAME record pointing at [YOUR
USERNAME].github.io. For more information, see
https://help.github.com/articles/setting-up-a-custom-domain-with-github-pages/.
I have also tried moving the project to its own Github organisation and pointing the CNAME to organisationname.github.io but it has the same result.
In both instances I have waited 24 hours for the DNS to propagate.
I have tried following the official tutorials and searching in StackOverflow for answers but have not been able to find anything for this situation.
Is this even possible to do or do the A records for my http://example.com domain affect all the subdomains below it?
Found a solution with Github support.
Turns out the answer is yes you can. I just had my apex domain configured to use Cloudflare and totally forgot about it. I made the changes described in my original post in Cloudflare and it all worked fine.

How to block access to a static site?

I will host a static site (just a few pages actually) on Netlify, a cloud hosting provider. It would be my notes and may have sensitive code and API keys. I want it set up so that only I can access this site from internet and no one else. How can I block access to the static site for others?
Alternately, if I do the same with with Github Pages, is it possible to restrict access there?
You need an access control mechanism to protect your notes.
If you are running the web server doing the hosting, most web server programs (Apache and nginx are the two most popular) have built-in access control mechanisms, see link given by Carsten H or see Access Control with Apache or How to Set Up Password Authentication with Nginx (Digital Ocean guide).
If you are using Github Pages, it is possible to do access control, but a bit more tricky. You can create a Github OAuth application and ask people to authenticate using your Github OAuth app. The app will ask for their username, and check if that username matches a list of allowed Github users (probably just your Github username). If the usernames match, static content is served up, otherwise the user is redirected to a 403 forbidden page.
Also see the github-heroku-attack-rabbits project page for details of how to create the Flask app mentioned above (using flask-dance to authenticate users via your Github OAuth app). The Flask app can be hosted for free on Heroku.
Two more things to note regarding public/private repos:
If you are using Github Pages, the repository containing your notes will need to be private, otherwise the contents of your notes will be in a public repository (even if the Github Pages static page has an access control layer).
Just because a repo is private does NOT mean its Github Pages page is private. By default, a private repo's Github Pages page is accessible/readable by the public. It is up to you to put an access control mechanism in place to protect the page.
You can try the encryption route. Here, the name staticrypt really says everything (I have a demo here). It allows you to create a password for each page for your website. It used AES-256 encryption, so as far as I am concerned, a long password should suffice.
If you don't share the password, you will be the only one to view the webpage.
These are actually two questions and is good practice to ask them individually.
This is a frequently asked question and depends on your server, e.g. for Apache you can edit your .htaccess following this instructions
you need to create a private repository by checking the private repository option during the repository creation

Password protect readthedocs.org documentation

I have a documentation managed on readthedocs.org. Is there a way to password protect or at least make our documentation available only for some of our customers?
Unfortunately, docs hosted on Read The Docs cannot be password-protected.
The best you can do (as of now) is to set your documentation to "Private" which will show users a 404 when they navigate to your docs from the www.readthedocs.org website. However, this is extremely weak security as anyone with the actual url can still view your documentation.
From their documentation:
With a URL to view the actual documentation, even private docs are viewable. This is because our architecture doesn’t do any logic on documentation display, to increase availability.
However, you could just host the Sphinx generated documentation yourself, and that you could password protect. I would say that is definitely your best bet!
Read the Docs is really just a convenience hosting service, you can still host your documentation elsewhere, and then easily password protect it just like you would password protect anything else.
Update
Btw, the easiest way to do that is to just generate generate static .html files - using make html from the root folder. Put those HTML files up on an internally hosted web server and you're good :)