Last active
November 10, 2019 04:01
-
-
Save miftahafina/c0295e33d27f5dd97a6387a5df83fa36 to your computer and use it in GitHub Desktop.
Install Droplet Ubuntu 16.04
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
Setup droplet | |
# create droplet ubuntu 16.04 | |
# setup private network | |
Edit via DO Dashboard | |
https://www.digitalocean.com/docs/networking/private-networking/how-to/enable/#ubuntu-16-04 | |
# initial setup (including firewall) | |
https://www.digitalocean.com/community/tutorials/initial-server-setup-with-ubuntu-16-04 | |
# Before ssh | |
ssh-keygen -R "you server hostname or ip" | |
# add user | |
sudo adduser namaente | |
# add to sudoer | |
usermod -aG sudo namaente | |
# update repo | |
sudo apt-get update | |
sudo apt-get dist-upgrade | |
# Updatedb (locate) | |
sudo updatedb | |
# Change timezone | |
timedatectl set-timezone Asia/Jakarta | |
# Install vim | |
sudo apt-get install vim | |
# Install tmux | |
sudo apt-get install tmux | |
# Install htop | |
sudo apt-get install htop | |
# Install zsh | |
sudo apt-get install zsh | |
sudo apt-get install git-core | |
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh | |
chsh -s `which zsh` | |
sudo shutdown -r 0 | |
# UFW Firewall | |
sudo ufw app list | |
sudo ufw allow OpenSSH | |
sudo ufw enable | |
sudo ufw status | |
sudo ufw reload | |
# Install nginx | |
https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04 | |
sudo apt-get install nginx | |
sudo ufw app list | |
sudo ufw allow 'Nginx HTTP' | |
systemctl status nginx | |
sudo ufw enable | |
# Manage nginx process | |
sudo systemctl stop nginx | |
sudo systemctl start nginx | |
sudo systemctl restart nginx | |
sudo systemctl reload nginx | |
sudo systemctl disable nginx | |
sudo systemctl enable nginx | |
sudo systemctl status nginx | |
sudo vim /var/log/nginx/error.log | |
# 413 - Entity too large | |
vi /etc/nginx/nginx.conf | |
add inside: http or server or location | |
client_max_body_size 2M; | |
# 504 - Gateway Time-out | |
https://asdqwe.net/blog/solutions-504-gateway-timeout-nginx/ | |
sudo vim /etc/nginx/nginx.conf | |
client_header_timeout 3000; | |
client_body_timeout 3000; | |
fastcgi_read_timeout 3000; | |
client_max_body_size 32m; | |
fastcgi_buffers 8 128k; | |
fastcgi_buffer_size 128k; | |
# Install vnstat network traffic monitor | |
sudo apt-get install vnstat | |
# LEMP | |
https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-in-ubuntu-16-04 | |
# 1. Install MySQL | |
sudo apt-get install mysql-server | |
mysql_secure_installation | |
- Disable validate password, anonymous user, and remote root login | |
- Remove database test | |
- Reload previlege | |
mysql -u root -p | |
# 2. Install PHP | |
sudo add-apt-repository ppa:ondrej/php | |
sudo apt-get update | |
sudo apt-get install php7.2 php7.2-mbstring php7.2-gd php7.2-mysql php7.2-xml php7.2-zip php7.2-curl php7.2-fpm | |
a. Configure php-fpm: | |
sudo vim /etc/php/7.2/fpm/php.ini | |
Change: ;cgi.fix_pathinfo=1 | |
to: cgi.fix_pathinfo=0 | |
sudo systemctl restart php7.2-fpm | |
sudo service php7.2-fpm status | |
sudo service php7.2-fpm start | |
b. Configure nginx to use PHP | |
sudo vim /etc/nginx/sites-available/default | |
Edit: | |
index index.php index.html index.htm index.nginx-debian.html; | |
server_name server_domain_or_IP; | |
location ~ \.php$ { | |
include snippets/fastcgi-php.conf; | |
fastcgi_pass unix:/run/php/php7.0-fpm.sock; | |
} | |
location ~ /\.ht { | |
deny all; | |
} | |
sudo systemctl reload nginx | |
c. Testing PHP | |
cd /var/www/ | |
sudo chown -R $USER:$USER (dir_name) | |
dst.. | |
# Install phpMyAdmin | |
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-with-nginx-on-ubuntu-16-04 | |
sudo apt-get install phpmyadmin | |
- Don't select web server, just tab + enter | |
- dbconfig-common: Yes, enter password | |
sudo ln -s /usr/share/phpmyadmin /var/www/html | |
sudo phpenmod mcrypt | |
- if mcrypt doesn't exists: | |
sudo apt-get install php7.1-mcrypt | |
sudo ln -s /etc/php/7.1/mods-available/mcrypt.ini /etc/php/7.2/mods-available/ | |
sudo phpenmod mcrypt | |
sudo systemctl restart php7.0-fpm | |
- Change pma symlink's name, for security purpose | |
mv /var/www/html/phpmyadmin /var/www/html/hehehe | |
ls -l /usr/share | |
- Error when importing phpMyAdmin: | |
https://medium.com/@chaloemphonthipkasorn/%E0%B9%81%E0%B8%81%E0%B9%89-bug-phpmyadmin-php7-2-ubuntu-16-04-92b287090b01 | |
- sudo vim /usr/share/phpmyadmin/libraries/plugin_interface.lib.php | |
- On #532 change to: | |
if ($options != null && count((array)$options) > 0) { | |
Still error when import | |
https://www.digitalocean.com/community/questions/how-to-extend-limit-of-import-file-in-phpmyadmin | |
https://stackoverflow.com/questions/39107272/phpmyadmin-mysql-error-in-processing-request-error-code-403-error-text-forbidd | |
https://www.digitalocean.com/community/questions/a-working-phpmyadmin-nginx-conf | |
[Read "Step 3 — Set Up an Nginx Authentication Gateway" for more informations on DO's post] | |
# Install adminer | |
wget https://github.com/vrana/adminer/releases/download/v4.6.3/adminer-4.6.3.php | |
Also install theme if you want | |
# Increase file upload size | |
sudo vim /etc/nginx/sites-available/default | |
- client_max_body_size 128m; // place this after "index", before (outside) "location" | |
sudo vim /etc/php/7.2/fpm/php.ini | |
- post_max_size = 128M | |
- upload_max_filesize = 128M | |
sudo service php7.2-fpm restart | |
# Install WordPress on LEMP | |
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lemp-on-ubuntu-16-04 | |
define('FS_METHOD', 'direct'); | |
# Error not found when changing WordPress permalink | |
https://www.digitalocean.com/community/questions/wordpress-and-nginx-404-errors-all-but-home-page | |
# Install NodeJS | |
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - | |
sudo apt-get install -y nodejs | |
# Setup reverse proxy | |
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-16-04 | |
=== | |
# Install PHPMyAdmin | |
https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-with-nginx-on-ubuntu-16-04 | |
# Encript SSL Nginx | |
https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04 | |
# Nginx Server Block | |
https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment