Skip to content

Instantly share code, notes, and snippets.

@robpataki
Last active February 14, 2017 10:27
Show Gist options
  • Save robpataki/1a39ba6abe9b28d2eee74d759e60a763 to your computer and use it in GitHub Desktop.
Save robpataki/1a39ba6abe9b28d2eee74d759e60a763 to your computer and use it in GitHub Desktop.
Linode Domain creation steps

Hosting a new domain on Linode with Apache

Setting up the necessary folders and permissions

sudo mkdir -p /root/public/example.com
sudo mkdir -p /root/public/example.com/backup
sudo mkdir -p /root/public/example.com/log
sudo mkdir -p /root/public/example.com/public
sudo chmod -R g+rwxs /root/public/example.com/public
sudo touch /etc/apache2/sites-available/example.com

sudo chown -R user:group /root/public/example.com/

Setting up the hosts file

sudo nano /etc/apache2/sites-available/example.com

Copy and paste (obviously update the details)...

# domain: example.com
# public: /roots/public/example.com/

<VirtualHost *:80>
	# Admin email, Server Name (domain name), and any aliases
	ServerAdmin       webmaster@example.com
	ServerName        www.example.com
	ServerAlias       example.com
	
	# Index file and Document Root (where the public files are located)
	DirectoryIndex    index.html index.php
	DocumentRoot      /root/public/example.com/public
	
	# Log file locations
	LogLevel          warn
	ErrorLog          /root/public/example.com/log/error.log
	CustomLog         /root/public/example.com/log/access.log combined
</VirtualHost>

Restarting the server...

sudo a2ensite example.com
sudo service apache2 restart
@robpataki
Copy link
Author

Also check out how to remove an unwanted domain/subdomain from Linode here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment