Last active
August 1, 2019 18:02
-
-
Save anushshukla/11888d531256805b9f8dfbf161451c23 to your computer and use it in GitHub Desktop.
Local Website Application Setup on LAN
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # go to the directory where we will keep the codebase for the local sites | |
| cd /var/www/html | |
| git clone githubRepoUrl | |
| sudo apt-get update -y | |
| #install apache2 | |
| sudo apt-get install apache2 | |
| #add PPA | |
| sudo add-apt-repository ppa:ondrej/php | |
| sudo apt-get update | |
| #install php5.6 first | |
| sudo apt-get install php5.6 -y | |
| #install php5.6 extensions | |
| sudo apt-get install php5.6-mbstring php5.6-mcrypt php5.6-mysql php5.6-xml php5.6-curl php5.6-memcached php5.6-memcached php5.6-redis memcached -y | |
| #install node and npm | |
| sudo apt-get install -y nodejs nodejs-legacy npm -y | |
| #check and confirm the node and npm versions are correct as per requirement | |
| npm -v | |
| node -v | |
| #apache2 enable php5.6 module | |
| a2enmod php5.6 | |
| #apache2 enable rewrite module required in all the vhost | |
| a2enmod rewrite | |
| #apache2 enable ssl module required for secured (https) | |
| a2enmod ssl | |
| #apache2 enable rewrite module required in vhost containing reverse proxy for nodejs application | |
| a2enmod proxy | |
| sudo a2enmod ssl | |
| sudo a2enmod proxy | |
| sudo a2enmod proxy_balancer | |
| sudo a2enmod proxy_http | |
| # after apache2 modules changes, apache2 needs to be restarted | |
| sudo service apache2 restart | |
| # goto the directory where all your sites configuration are done | |
| cd /etc/apache2/sites-available/ | |
| # creating virtual hosts as per the sites you want to setup on local | |
| sudo touch site.com.conf | |
| # SSL for yourFirstName.site.com | |
| openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -in /etc/php5/cacert.pem -keyout site.com.key -out site.com.crt -config /etc/ssl/openssl.cnf | |
| # move SSL Keys to the right folders | |
| mv site.com.key site.com.key /etc/ssl/private | |
| # enable your sites which you have created | |
| sudo a2ensite site.com | |
| sudo vi /etc/hosts | |
| Press Shift+G (takes you to the last line) | |
| Press Insert keyboard key (lets you edit the file) | |
| Press End Keyboard key (takes you to end of the line) | |
| 127.0.0.1 yourFirstName.site.com | |
| # does config-test and gives verbose O/P incase of error | |
| apache2ctl -t | |
| # after apache2 sites configuration changes, it needs be reloaded | |
| sudo service apache2 reload | |
| #copy paste the output of the below | |
| whoami | |
| # To be able to edit files as the owner and at the same time letting www-data user be able to access the files | |
| sudo chown 'copy-paste-here':www-data -R var/www/html/ | |
| # permission required for write by www-data group user | |
| chmod 777 /var/www/html/site.com/cacheDir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment