Skip to content

Instantly share code, notes, and snippets.

@maxg203
Last active May 25, 2017 12:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maxg203/440f7f0fc8ea75edbef4568b142def4e to your computer and use it in GitHub Desktop.
Save maxg203/440f7f0fc8ea75edbef4568b142def4e to your computer and use it in GitHub Desktop.
Apache Server Admin and Deployment

Setup Vagrant Box

Select a Vagrant Box from https://vagrantcloud.com

# Add it to your list of boxes
vagrant box add ubuntu/trusty64

# Create a new folder for your project & init vagrant
vagrant init ubuntu/trusty64

# Run your new machine
vagrant up

# ssh into your new machine
vagrant ssh

Now you are connected to a new machine!

  • hit exit to disconnect

Let's make this feel like the real world by adding a fake domain name

  • open the Vagrantfile and uncomment the private_network line & change to your desired IP
    • config.vm.network "private_network", ip: "22.22.22.22"
    • run vagrant reload
  • make a fake domain for that ip
    • run sudo open /etc/hosts -a Atom to open your /etc/hosts file in Atom
    • add this line to the end of the file and save 22.22.22.22 dev.mysite.com

Nice! Now going to mytestsite.com will connect to our machine!

Now Run These Comands on the Vagrant Virtual Server

sudo apt-get install apache2 This installs the industry standard Apache web server sudo apt-get install htop Gives you access to the htop command for monitoring of resources and background processes cd /var/www/html Change directory (not necessary, but easy to verify files have transferred if you are already in the right directory)

If you're using Vagrant, the username and password are both set to vagrant by default.

sudo adduser <username> www-data
sudo chown -R www-data:www-data /var/www
sudo chmod -R g+rwX /var/www

These commands give permission to use SFTP to connect and transfer files to the server. SFTP is not the fastest or most secure way to transfar files to the web server but it is easy for beginners as you can use an FTP client with a GUI like FileZilla. That is what I use for any type of FTP file transfers personally.

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