OUTDATED! I have not intention or want to update this. The bellow is basicly ripped strait from the tor site but I thought I would rehash the apache stuff. This is basicly just me announcing that my site is now avalible through tor. I have also configured apache to put a coustom header that displayes on the tor browser that my website is avalible via tor. If for any reason I lose my domain, my words are still avalible there. Happy reading!

You can enable your tor service in /etc/tor/torrc where there will be a line (at the time of writing this it is about 70 lines down) called HiddenServiceDir and it will have a HiddenServicePort, both lines need commenting out. You can then run systemctl restart tor or what ever init system you use. It will generate a folder in /var/lib/tor/hidden_service (unless you changed the name of the hidden service dir). It will contain a hostname which containts your onion address in.

From there you can add:

<VirtualHost *:80>
	ServerName tldr-your-address-here.onion

	ServerAdmin webmaster@localhost
	DocumentRoot /var/www/html-tldr-your-webroot-here

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined

	<Directory /var/www/html>
        	Options Indexes FollowSymLinks
        	AllowOverride All
        	Require all granted
	</Directory>

This should give you a basic tor website. You can use your hostname (the onion one) and test it by navigating to tor’s website. If it works you can procede. From here you need to check what is going on.

To enable the headers required for the onion location tag on apache, you need to run the following commands.

sudo a2enmod headers rewrite
sudo systemctl reload apache2

On your website you need to add the coustom header to your page. This can be done on both ssl and non-ssl sites but we do oc recomend you get a ssl website. The block bellow would go in with your base config for the site. Header set Onion-Location "http://your-onion-address.onion%{REQUEST_URI}s"

Then it is just a matter of restarting your web server with: sudo systemctl reload apache2

This is the finnished result: Example Of Tor Location In Action

Source: https://community.torproject.org/onion-services/advanced/onion-location/