- ubuntu 16.04
- php 7.1
- apache 2.4
- mysql 5.7
- git & composer
- "sudo dpkg-reconfigure tzdata" : set system timezone
- "sudo apt-get update"
- "sudo add-apt-repository ppa:ondrej/php" : add php offical repository
- "sudo apt-get update"
- "sudo apt-get -y install php7.1 php7.1-common php7.1-zip php7.1-xml php7.1-mbstring php7.1-mysql php7.1-mcrypt php7.1-cli libapache2-mod-php7.1"
- "sudo apt-get -y install apache2"
- "sudo a2dismod php5" : disabled apache use php5
- "sudo a2dismod php7.0" : disabled apache use php7.0
- "sudo a2enmod php7.1" : enable apache use php7.1
- "sudo a2enmod rewrite" : enable apache use rewrite
- "cd /etc/apache2/sites-available"
- "vim {name}.conf"
- paste
<VirtualHost *:80>
ServerName {your IP}
DocumentRoot /path/to/public
<Directory "/path/to/{your application}">
AllowOverride all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
- (option) http to https
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
</VirtualHost>
- "ln -s /etc/apache2/sites-available/{name}.conf /etc/apache2/sites-enabled/{name}.conf"
- "rm /etc/apache2/sites-enabled/000-default.conf" : remove default conf
- "sudo service apache2 restart"
suggest use different account for application and root
- "sudo apt-get install mysql-server"
- "mysql -u root -p"
- after into mysql : "create database {your database name}"
- CREATE USER 'application'@'%' IDENTIFIED BY 'application';
- "GRANT ALL ON {your database name}.* TO 'application'@'%';"
- "FLUSH PRIVILEGES;"
- first build master mysql & slave mysql
- master mysql : "GRANT REPLICATION SLAVE ON . TO 'repl'@'%' IDENTIFIED BY 'repl';"
- master : "sudo vim /etc/my.cnf"
- paste :
server-id = 1
default-character-set = utf8
default-storage-engine = innodb
bind-address = 0.0.0.0
log-bin = mysql-bin
binlog_format = row
log_slave_updates = 1
expire_logs_days = 7
gtid-mode = ON
enforce-gtid-consistency = ON
- master : "sudo service mysql restart"
- slave : "sudo vim /etc/my.cnf"
- paste :
server-id = 2
default-character-set = utf8
default-storage-engine = innodb
bind-address = 0.0.0.0
log-bin = mysql-bin
binlog_format = row
log_slave_updates = 1
expire_logs_days = 7
gtid-mode = ON
enforce-gtid-consistency = ON
- slave mysql : "CHANGE MASTER TO MASTER_HOST='{master_mysql_ip}', MASTER_PORT={master_mysql_port},MASTER_USER='repl', MASTER_PASSWORD='repl',MASTER_AUTO_POSITION = 1;"
- slave mysql : "START SLAVE;"
- check mysql salve is ok : "show slave status\G"
- "sudo apt-get install git -y"
- "sudo curl -sS https://getcomposer.org/installer -o composer-setup.php"
- "sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer"
- "sudo rm composer-setup.php"
- "sudo mkdir ~/{your application}"
- "cd ~/{your application}"
- "git clone {remote git repository}"
- "composer install"