We summarized our experience on setting up WordPress on LEMP Ubuntu 18.04. We use Digital Ocean as our virtual private server. It comes with PHP7.2, FPM, and Certbot pre-installed. Nice isn’t it!
- Enable SSH to accept outside root connection. Open /etc/ssh/sshd_config, find PermitRootLogin and PasswordAuthentication lines. Set it to yes, and restart sshd by executing sudo service ssh restart.
- Install NGINX on Ubuntu first. The point is the NGINX must be allowed by the Uncomplicated Firewall (UFW) first.
- Install WordPress. Here is the shortlist: Create database, grant user, setting up NGINX, create configuration file for your website inside sites-available, setting up wp-config.php, restart FPM and restart NGINX.
- Install SSL. LEMP Ubuntu 18.04 on Digital Ocean comes with Certbot pre-installed. Just type ‘certbot’ in the command line.
- BONUS. Setting up HTTP2. This can speed up the website up to 2x.
By the way, there is question which is better upgrading from Ubuntu 14.04 to Ubuntu 18.04 to enable PHP7 for WordPress or start from fresh droplet or VPS account? The answer is better to start from the fresh one.
Upgrading from 14.04 to Ubuntu 18.04 will require you to upgrade to Ubuntu 16.04 first, in the meantime your server will be down and you’ll be firefighting the error. We don’t recommend upgrading your system. Start from a fresh droplet is easier and safer. Trust us.
Before creating the Let’s Encrypt SSL Certificate you must do the following basic prerequisites first.
- Don’t forget to put your domain inside
- Create NGINX configuration file in
- Create symbolic link to your domain’s NGINX configuration file inside
- Test your setting by executing
$ nginx -t. If all good then restart the server
$ service nginx restart
Let’s go enable your http into https and redirect the http to https forever.
Continue reading Create and Delete SSL Certificate Let’s Encrypt
I Googled so much and can’t find any simpler method to count files or folders in a directory in Linux. I am using Ubuntu 14.04. If it’s only files and folders, it would be simple.
Count Files and Folders
$ ls -l | wc -l
wc -l command is read “WordCount lines”. It means after you executed the
ls, the corresponding result will be counted by it’s line. For example, if you are using
ls in your working directory, say there are 2 files and 2 folders, it will return 4 lines. If you add it becomes
ls -a, it will return 2 more lines. So, it returns 6 lines because of “.” and “..” are counted.
Continue reading Count Number of Files and Folders in a Directory Using Terminal
I’ve discovered the hidden treasure at superuser to change the permission of directories or files recursively in a folder. Not quite simple, but straight. To recursively give directories read & execute privileges:
Continue reading Changing Directory and Files Permission Recursively in Linux
Now, say you don’t know how to create Gruntfile.js manually just like I was. You’re desperately want to use Compass (grunt-contrib-compass) and Watch (grunt-contrib-watch) to develop your project. First, you have to install it in your project folder as node_modules:
$ npm install grunt-contrib-compass grunt-contrib-watch
That will install the Compass and Watch into node_modules directory in your project folder. Yes, it’s installed locally.
Continue reading My Gruntfile.js Content Using Compass and Watch
Some of you might be very disturbed by a question of how to know Node.js packages which globally installed in your Ubuntu 14.04 LTS. Such a terrible nightmare. But, the nightmare should be vanished using this simple one liner:
$ npm ls -g --depth=0
That line would be similar to:
$ ls /usr/lib/node_modules
How to refer NPM Local to NPM Global? If you don’t want to install the packages locally because it’s wasting hardisk space you can use the packages which have globally installed.
For example, you install the sass package globally:
$ sudo npm install -g grunt-contrib-sass
You don’t want to do the same for your project, project, and another project because you think the files are the same but just the locations which make it different.
So, in case we want to install sass package from global to local we can use
link directive in your project folder:
$ npm link grunt-contrib-sass
It will automatically create
node_modules/grunt-contrib-sass link to grunt-contrib-sass global package. Piece of cake.
Installing Node.js is not as difficult as a year ago. You can simply install it through your Terminal. First get the installer.
$ curl -sL https://deb.nodesource.com/setup | sudo bash -
And then install it with
$ sudo apt-get install -y nodejs
Continue reading Installing Node.js, NPM, Grunt, and Yeoman in Ubuntu 14.04 LTS
It was suck. I’ve spent hours to find this solution. If you want to change your Ubuntu 14.04 LTS text editor by changing
/usr/share/applications/defaults.list and then you may find it doesn’t work, you can try edit the
Continue reading Change Text Editor Ubuntu 14.04 LTS Without /usr/share/applications/defaults.list
My db-cache-reloaded had made my day very bad. My site considered as Malware site. So, I asked Hostgator support to scan all my directories upon my account. Then, Krasimir (Security Administrator) guy found the obsolete db-cache-reloaded made bad effect because it allows any hacker to exploit files. That’s horrible.
I asked him about how to remove all db-cache-reloaded from my account. He recommended of using two commands in order to avoid removing files I might need. First, he told me that I can find all instances of db-cache-reloded and then remove it. Here are the commands:
Continue reading How to Find Folders and Remove It Manually with SSH