-
-
Save frank-liu/c40a094869c371e97b7e50088106f392 to your computer and use it in GitHub Desktop.
Ubuntu 14.04 Setup: nginx + varnish + memcached + php5.6 + mysql5.6 + Mongodb 2.6.7 + phpmyadmin
This file contains 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
# Basic | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install htop | |
sudo apt-get install curl | |
#MySQL | |
sudo apt-get install mysql-server-5.6 php5-mysql | |
sudo mysql_install_db | |
sudo /usr/bin/mysql_secure_installation | |
#Update MySQL (If not done in previous step) | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install mysql-server-5.6 | |
#nginx | |
sudo apt-get update | |
sudo apt-get install nginx | |
sudo service nginx start | |
#php | |
sudo apt-get install php5-fpm | |
sudo apt-get install software-properties-common | |
sudo add-apt-repository ppa:ondrej/php5-5.6 | |
sudo apt-get update | |
sudo apt-get upgrade | |
sudo apt-get install php5-fpm | |
#php configure | |
sudo nano /etc/php5/fpm/php.ini #Find the line, cgi.fix_pathinfo=1, and change the 1 to 0. | |
sudo service php5-fpm restart | |
#configure nginx sites-available | |
sudo nano /etc/nginx/sites-available/default #add index.php to list of types to read | |
#Replace file content with | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /usr/share/nginx/html; | |
index index.php index.html index.htm; | |
server_name server_domain_name_or_IP; | |
location / { | |
try_files $uri $uri/ =404; | |
} | |
error_page 404 /404.html; | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
fastcgi_pass unix:/var/run/php5-fpm.sock; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
} | |
#phpmyadmin | |
sudo apt-get update | |
sudo apt-get install phpmyadmin | |
#Select none of the two options | |
#Select yes to common db config | |
sudo ln -s /usr/share/phpmyadmin /usr/share/nginx/html | |
sudo php5enmod mcrypt | |
sudo service php5-fpm restart | |
#secure phpmyadmin | |
sudo apt-get install apache2-utils | |
sudo htpasswd -c /etc/nginx/.htpasswd dev | |
sudo nano /etc/nginx/pma_pass | |
sudo nano /etc/nginx/sites-available/default | |
#add | |
location /phpmyadmin { | |
auth_basic "Restricted"; | |
auth_basic_user_file /etc/nginx/.htpasswd; | |
} | |
sudo service nginx restart | |
#mongodb | |
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 -y mongodb-org | |
sudo service mongod start / sudo service mongod restart | |
mkdir /data | |
mkdir /data/db | |
mongod | |
mongo | |
#create mongodb users: http://docs.mongodb.org/manual/tutorial/add-user-administrator/ | |
nano /etc/mongod.conf | |
#fix bind so other servers can connect, bind_ip = 127.0.0.1, X.X.X.X | |
#set auth = true | |
sudo service mongod restart | |
#memcache | |
sudo apt-get update | |
#php 5.5 | |
sudo apt-get install mysql-server php5-mysql php5 php5-memcached memcached | |
#php 5.6 | |
sudo apt-get install mysql-server php5-mysql-5.6 php5 php5-memcached memcached | |
sudo service php5-fpm restart | |
sudo service memcached restart | |
#varnish | |
sudo apt-get install apt-transport-https | |
curl https://repo.varnish-cache.org/ubuntu/GPG-key.txt | sudo apt-key add - | |
sudo sh -c 'echo "deb https://repo.varnish-cache.org/ubuntu/ trusty varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list' | |
sudo apt-get update | |
sudo apt-get install varnish | |
sudo nano /etc/default/varnish | |
#Change port 6081 to port 80 under DAEMON_OPTS | |
sudo nano /etc/nginx/sites-available/default | |
#Change all ports to 8080 | |
sudo service nginx restart | |
sudo service varnish restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment