- Buy a domain (misk, namecheap, google domains)
- Set custom nameservers, I’m using Linode
ns1.linode.com
ns2.linode.com
ns3.linode.com
ns4.linode.com
ns5.linode.com
3. Clone the dns entry in linode (just Domains, then Clone)
4. Setup Up Name Based Virtual Host and Destination Directory
I have an apache server setup, so I need to make a new file to configure the virtual host.
// Create a folder for the new location $ cd /var/www $ mkdir mynewwebsite.com $ cd mynewwebsite.com $ touch index.html // Then you can add a test sentence there
// Go make the new file for the apache configuration // I copy an old config to a new one.
$ cd /etc/apache2/sites-available/ $ sudo cp currentsite.com.conf mynewwebsite.com.conf
// Then I go into vim and substitute the new name for the old name.
Using this vim command :%s/currentsite/mynewwebsite/g
1 <VirtualHost *:80> 2 3 ServerAdmin adminemail@gmail.com 4 ServerName mynewwebsite.com 5 ServerAlias www.mynewwebsite.com 6 DocumentRoot /var/www/mynewwebsite.com 7 8 <Directory /var/www/mynewwebsite.com> 9 Options Indexes FollowSymLinks 10 AllowOverride All 11 </Directory> 12 </VirtualHost>
// Enable the site so it goes into the sites-enabled directory $ sudo a2ensite mynewwebsite.com Enabling site mynewwebsite.com. Run ‘/etc/init.d/apache2 reload’ to activate new configuration!
// Then restart apache
$ sudo service apache2 restart * Restarting web server apache2 … waiting [OK].
5. Check https setup and forwarding with certbot
$ sudo certbot
Select the domain name you created, and then select a redirect option
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for mynewwebsite.com
http-01 challenge for www.mynewwebsite.com
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/mynewwebsite.com-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/mynewwebsite.com-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/mynewwebsite.com-le-ssl.conf
Deploying Certificate to VirtualHost /etc/apache2/sites-available/mynewwebsite.com-le-ssl.conf
Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2
6. Set up git directory with checkout update
Set up using this script: https://gist.github.com/jkeesh/b19058c6c52f35fb88397037f451a27d
In the repos directory on my webserver
jkeesh@localhost:~/repos$ python create_repo.py newwebsite.git /var/www/newwebsite.com/
Then on my local computer:
Create a git repository, add files, and push to the website.
$ git remote add web ssh://jkeesh@thekeesh.com/home/jkeesh/repos/newwebsite.git
$ git push web master
Then I create a new repo on github, and add that as a remote too.
$ git remote add origin git@github.com:jkeesh/newwebsite.git
√ $ git push -u origin master
Test it out!