Skip to content

Instantly share code, notes, and snippets.

@masasdani
Last active August 29, 2015 13:57
Show Gist options
  • Save masasdani/9350002 to your computer and use it in GitHub Desktop.
Save masasdani/9350002 to your computer and use it in GitHub Desktop.
standar config server
#ubuntu 12.04
#add a sudo user
adduser username
adduser username sudo
#setting timezone
sudo dpkg-reconfigure tzdata
#install lamp
sudo apt-get update
sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install phpmyadmin
#git
sudo apt-get install git
#java
sudo apt-get install maven
#download jdk7 from oracle using wget
sudo mkdir -p /usr/lib/jvm/jdk1.7.0
sudo mv jdk1.7.0_03/* /usr/lib/jvm/jdk1.7.0/
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
#download tomcat from apache
#mongo-org
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install mongodb-org
#install specific mongodb
apt-get install mongodb-org=2.6.1 mongodb-org-server=2.6.1 mongodb-org-shell=2.6.1 mongodb-org-mongos=2.6.1 mongodb-org-tools=2.6.1
#enable apache proxy redirect
sudo a2enmod proxy
sudo a2enmod proxy_ajp
sudo a2enmod proxy_balancer
sudo a2enmod proxy_connect
sudo a2enmod proxy_ftp
sudo a2enmod proxy_http
sudo a2enmod proxy_scgi
sudo a2enmod redirect
sudo service apache2 restart
#change /etc/phpmyadmin/apache.conf
Alias /db/administrator/phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php
AllowOverride All
#change /usr/share/phpmyadmin/.htaccess
AuthType Basic
AuthName "Restricted Files"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
#set user and password htpasswd
sudo htpasswd -c /etc/apache2/.htpasswd username
sudo service apache2 restart
NameVirtualHost *:80
// redirect sub domain to port
<VirtualHost *:80>
ServerName application.domain.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://www.domain.com:8080/application/
ProxyPassReverse / http://www.domain.com:8080/application/
</VirtualHost>
// redirect to another domain
<VirtualHost *:80>
ServerAlias domain.co
redirect permanent / http://domain.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:\<pathToApache>\www
ServerName www.domain.com
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment