Sometimes when you need a website which isnt public and you wish to share it with a select few. At such times you can easily get an URL with a .onion TLD. With your computer as the server you are assured that your files hosted on the site are safe on your own computer and are being shared with the right people.
First of all, you will need to install the TOR(The Onion Router) browser. This is a special browser that focuses on anonymity of the user. All the sites you visit using it are routed via a proxy server, thus, it doesnt let the site know your real identity. Websites using .onion as TLD are only accessible via the TOR browser or through certain websites like tor2web.org.

In case you want your site to be accessible via normal browsers then you need to append .to at the end of an .onion URL. This isnt recommended because there is a chance that your site may fail to load.

Now let’s start by installing a Web Server on our computer. You can use XAMPP and other popular web server packages but you risk disclosing your actual IP, hence, it is advised to use Savant.

Setting up the server

Start Savant and click on the Configuration tab and a pop-up should appear. In the Server DNS Entry option, type localhost and in Port # To Server From type 8080. If this doesnt work then try port 80 or any other open port for your system. After clicking apply open any browser and visit localhost:port, replace port with 8080 or with whichever you went with. If the page loads then youve got it right, if not then re-check all the steps. The page that just loaded was from your own PC only and that too from C:\Savant\Root directory. As a general rule index.html will be acting as your default/first-loading page.

Note: Savant is very unstable so you can use uniformserver as well

Obtaining your URL

Now almost everything is done, we just need to tell TOR about our server and then it will provide us our URL. Before we begin you need to create a folder on your desktop which will be used by TOR to provide you the URL of your site. Close your TOR browser if it is open and then go to your TOR installation directory, look for a folder labelled Data, in it open the Tor folder and look for a file named torrc. Open it in any text editor program and enter the following lines in it.

HiddenServiceDir C:\Users\YOUR_USERNAME\Desktop\NAME_OF_FOLDER HiddenServicePort 80 127.0.0.1:YOUR_PORT

in the above two lines make sure to edit your_username with your computers username and name_of_folder with the name of empty folder that you just created on your desktop. Also make sure to replace the word your_port, with the port that you entered in Savant.

Now you need to save this file and then open TOR browser, so that TOR can generate a URL and Private Key for your website. Wait for 5-6 seconds and then close TOR browser.

Now navigate to the folder that youd created on your desktop and you will find two files in it Hostname and private_key. You dont have to do anything with private_key, its there for identification purposes.

Open the file Hostname with any text editor and youll find the URL of your website with .onion as TLD. For me the URL was
utfd24oh7n43kxj2.onion and to visit the website you need to append /index.html after .onion so the URL becomes

**http://utfd24oh7n43kxj2.onion/index.html**

Dont delete the folder that youve created on your desktop. Running an anonymous site is not an easy task and its possible that the authorities may crack down on you if you engage in any illegal activity.