Cai dat server ubuntu bản chuẩn của Tuấn

<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
EE on ubuntu 16-04 for wp.txt
Bước 1: 
	ssh root@45.77.132.75
	Insert Pass: H[6c@=N?G9JV+mQe
	# Cài đặt và sử dụng Easy Engine
Bước 2:	
    wget -qO ee rt.cx/ee && sudo bash ee     		
    Tham khảo: https://community.easyengine.io/t/easyengine-installation-instruction-missing-a-step/3340
	# install easyengine
    $sudo nano /etc/ee/ee.conf 							
	# Setup user pass mail defaul for login wordpress
	### User name for WordPress sites
	user = lionel
	## Password for WordPress sites
	password = lionelpham
	## EMail for WordPress sites
	email = phamngoctuong1805@gmail.com
Bước 3: save changes and exit (Control+O + Enter then Control+X+ Endter).														
	sudo ee site create lionelpham.com --wp  		# Create and install wordpress on example.com
	#or
		sudo ee site create lionelpham.tk --wp --w3tc		# Create and install wordpress on example.com with plugin w3tc
	#or
		Basic WP install (without any caching)
		sudo ee site create domain.com --wp --basic
	#or
		Basic WP install (without any caching):
		sudo ee site create domain.com --wp --w3tc
	#or WP Install with WP Super Cache plugin
		sudo ee site create domain.com --wp --wpsc
Bước 4: Thụ hưởng thành quả rồi
	Vào file host sửa thành	45.77.132.75 lionelpham.com
	Vào file host sửa thành	45.77.132.75 example.com
==============================================================================================================
# Tạo phpMyAdmin   
#link: https://easyengine.io/tutorials/php/phpmyadmin/
	$sudo ee stack install --phpmyadmin 	
	# install phpmyadmin
	curl -sS https://getcomposer.org/installer | php -- --filename=composer --install-dir=/usr/local/bin  
	# Installing Composer
# Create a subdomain for phpmyadmin
	Bước 2: sudo ee site create phpmyadmin.example.com --wp
	<!-- sudo ee site create sub.example.com --wp -->
# Delete db of subdomain site
	ee site delete phpmyadmin.example.com --db
# Delete file config subdomain site
	cd /var/www/phpmyadmin.example.com
	rm -rf wp-config.php
# Delete all file in htdocs subdomain
	cd /var/www/phpmyadmin.example.com/htdocs
	rm -rf *
# Clone phpmyadmin
	git clone https://tuantienle@bitbucket.org/tuantienle/phpmyadmin401020.git
# Copy all file to htdocs
	cp -r /var/www/phpmyadmin.example.com/htdocs/phpmyadmin401020/. /var/www/phpmyadmin.example.com/htdocs
# view pass root mysql
	cat /etc/mysql/conf.d/my.cnf
# Login to root mysql (Ghi nho pass vua xem)
	cd
	mysql -u root -p
# Change pass root mysql
	UPDATE mysql.user SET Password = PASSWORD('tuongpn805') WHERE User = 'root'; 
	FLUSH PRIVILEGES;
	CTRL + C
# Update pass for root
	nano /etc/mysql/conf.d/my.cnf
	adfdf => tuongpn805 (Update pass)
	CTRL + X => Y + ENTER
#Delete sup
	rm -rf 	/var/www/phpmyadmin.example.com
==============================================================================================================
# Tạo user sFTP và phân quyền trong server Linux dùng Easy Engine
# THIẾT LẬP LẦN ĐẦU
Bước 1:
# Create Users
	useradd -G www-data -ms /bin/false tuongpn
	passwd tuongpn
Bước 2:
# Tạo password
	password: tuongpn1805
Bước 3:
# Create SFtp Home Directory
	mkdir -p /home/tuongpn/example.com/htdocs
Bước 4:
# Setup Permissions
	chown tuongpn:www-data /home/tuongpn/example.com
	chown root:root /home/tuongpn/
	chown root:root /home/
# The permissions should look like this for example.com directory, after executing above command.
Bước 5:
	ls -ld /home/
		<!-- drwxr-xr-x 5 root root 4096 Nov 24 06:42 /home/ -->
	ls -ld /home/tuongpn/
		<!-- drwxr-xr-x 3 root root 4096 Oct 24 06:42 /home/lionel -->
	ls -ld /home/tuongpn/example.com
		<!-- drwxr-xr-x 2 lionel www-data 4096 Oct 31 08:49 /home/lionel/example.com -->
Bước 6:
# Setup sftp-server
	nano /etc/ssh/sshd_config
		# Find below line
			Subsystem sftp /usr/lib/openssh/sftp-server
		# Replace above line with following line
			Subsystem sftp internal-sftp
		# Add following lines at after file
			Match group www-data 
			X11Forwarding no 
			ChrootDirectory %h 
			AllowTcpForwarding no 
			ForceCommand internal-sftp
Bước 7:			
=>>>>>>>>> CTRL + X + Y => Enter
# Restart ssh service
	systemctl restart sshd.service
# Setup webroot permissions
	chmod g+s /var/www/example.com/htdocs/
	chmod 775 /var/www/example.com/htdocs
# Mount webroot in SFtp home directory
	mount --bind /var/www/example.com/htdocs /home/tuongpn/example.com/htdocs
# add above command in /etc/rc.local
	nano /etc/rc.local
			#!/bin/sh -e
			#
			# rc.local
			#
			# This script is executed at the end of each multiuser runlevel.
			# Make sure that the script will "exit 0" on success or any other
			# value on error.
			#
			# In order to enable or disable this script just change the execution
			# bits.
			#
			# By default this script does nothing.
			mount --bind /var/www/example.com/htdocs /home/tuongpn/example.com/htdocs
			exit 0
Bước 7:			
=>>>>>>>>> CTRL + X + Y => Enter
==============================================================================================================
# HTTPS FOR WEBSITE
# install letsencrypt
Bước 1: http://www.dot.tk/en/index.html đăng ký domain free Ví dụ: maxlionel.tk
Bước 2: Insert DNS 45.77.132.75
Bước 3: ee site create maxlionel.tk --wp  --letsencrypt
Bước 4: install plugin simple ssl in website
# Update website to https
Bước 1: ee site update maxlionel.tk --letsencrypt
Bước 2: nano /var/www/maxlionel.tk/conf/nginx/ssl.conf #|Delete http2
Bước 4: Bước 3: CTRL + X => Y => Enter
systemctl restart nginx
========
</body>
</html>

Last updated