Setting up LEMP stack in Ubuntu and other platforms is not a big deal. However, if you want to setup some additional functionalities such as installing SSL certificates, optimizing cache to increase the site speed, adding extra layer of protection, increasing the speed of serving the content and a lot more, I suggest you to take a look at a script called Webinoly. It is a simple script that allows you to easily and securely setup optimized LEMP stack for wordpress and other type of websites in Ubuntu operating system. Just rent a VPS or dedicated server, install Ubuntu and deploy your web server environment to host websites in minutes using Webinoly.
Using Webinoly script, we can easily deploy the following in Ubuntu system:
- Nginx web server with FastCgi Cache and Redis Object Cache
- MariaDB (MySQL)
- Wordpress or any type of websites like HTML, PHP.
In addition, it provides a set of tools and commands to add the following extra features and best practices for your websites:
- Install free SSL certificates for your site with Let's Encrypt.
- Enable HTTP/2 support to increase the speed of the contents of your websites.
- Configure FastCgi Cache and Redis Object Cache to increase website loading time.
- Get an A+ grade on Qualys (SSL Labs) Test.
- Automatically optimize your webserver to get the most out of the available resources.
- Configure and modify your server configuration as per your requirements.
- Single or multisite wordpress deployment.
- Unique commands to easily create, disable and delete sites.
- Install Duplicity tool to backup your sites to external services like Amazon S3, among others.
- Install PhpMyAdmin to manage databases via a web browser.
- Support for automatic configuration of external databases such as Amazon RDS.
- Install Postfix to send and receive mails from your site.
- Automatic WordPress configuration and optimization
- Activate an extra layer of protection on the WordPress login page with HTTP Authentication.
- Upload or update contents of your sites via SFTP.
- Log viewer in real time.
- And a lot more.
Webinoly is completely open source and free and its source code is available on GitHub.
Easily Setup Optimized LEMP Stack And Wordpress In Ubuntu
As of writing this guide, Webinoly supports only Ubuntu 16.04 or 18.04 LTS editions. Like I already said, setting up optimized LEMP webserver is not that hard. All you have to do is run the following commands in your Ubuntu machine.
$ sudo ap-get install wget
$ wget -qO weby qrok.es/wy && sudo bash weby 3
Now, sit back and have a cup of coffee. The above commands will install and configure all necessary tools, enable security features and best practices for your LEMP web server. At the end of installation, you will be given your database access passwords of root and admin users. Change them and save them in a secure place.
Once the LEMP server is ready, deploy your first Wordpress site using command:
$ sudo site example.com -wp
You will be asked a series of questions. Answer accordingly and complete the wordpress site creation.
Do you need to setup new MySQL database? [Y/n] Create WP-Config file automatically? [Y/n] Database Host [localhost]:Database Name [example_com]: Database User [example_com]: Database Password [A4PXURg5]: Database Prefix [wp_]: Site example.com has been successfully created!
To access PhpMyAdmin dashboard, navigate to http://domain.com:22222 URL from your web browser. Replace domain.com with your own domain name.
Similarly, you can deploy any single or multisite wordpress instances easily and quickly.
Webinoly Command line usage
Webinoloy provides a handful of commands to perform the following tasks:
- Manage, configure your web server using webinoly command.
- View logs using log command.
- Install, remove tools installed by Webinoly on your Ubuntu server using stack command.
- Create and manage websites using site command.
- Configure HTTP authentication using HttpAuth command.
"Webinoly" command examples
The webinoly command is used to manage, configure and modify settings in your webserver.
To view all details about the installation, configuration and optimization made by Webinoly script, run:
$ sudo webinoly -info
Update Webinoly to latest available version:
$ sudo webinoly -update
Verify the integrity of the files related to Webinoly and other installed packages:
$ sudo webinoly -verify
If you haven't set the timezone in PHP already, you can set it at any time using the command:
$ sudo webinoly -timezone
Webinoly saves a copy of your DB username and password generated automatically during the installation.
To view your DB username and password, run:
$ sudo webinoly -dbpass
Please note that if you have already changed automatically generated passwords, you can't recover them at present. This is a bug and is expected to be fixed in the next release.
Webinoly uses port 22222 for all tools by default. If you want to change the port, run the following command and enter your proffered port number:
$ sudo webinoly -tools-port
Or, simply use this command:
$ sudo webinoly -tools-port=<port-number>
Webinoly allows you to upload files to your website root directory through SFTP. You can allow SFTP access to www-data user, run:
$ sudo webinoly -login-www-data
The www-data user has very limited permissions and can be able to access your site via SFTP only. To revoke the permission, simply run:
$ sudo webinoly -nologin-www-data
Modify FastCGI cache settings using command:
$ sudo webinoly -config-cache
The time parameters should be specified in the following format:
- s – seconds
- m – minutes
- h – hours
- d – days
- w – weeks
- M – Months
- y – years
$ sudo webinoly -config-cache=[20d,2w,2m]
Webinoly uses the following plugins to serve your site contents faster.
You can clear the cache at any time. For example, to clear FastCGI cache, run:
$ sudo webinoly -clear-cache=fastcgi
To clear all cache, the command would be:
$ sudo webinoly -clear-cache=all
"Log" command examples:
The log command is used to view log details and various events happened on your Ubuntu server.
To view all logs, run:
$ sudo log
To view the log details of a particular site, for example domain.com, run:
$ sudo log domain.com
To view all error log, use:
$ sudo log -error
To view error log of a particular domain:
$ sudo log domain.com -error
To view wordpress related logs, run:
$ sudo log domain.com -wp
To view logs generated by an application like PHP, MySQL, do:
$ sudo log -php
$ sudo log -mysql
If you don't want logs, just turn them off as shown belwo.
$ sudo log -only-error=on
$ sudo log dominio.com -only-error=on
To activate the logs again, use
"Stack" command examples:
The stack command is used to install and remove packages and tools installed by Webinoly script.
Let us say, if you want to install Nginx, simply run:
$ sudo stack -nginx
$ sudo stack -mysql
Or, install the whole LEMP stack with command:
$ sudo stack -lemp
To remove a package, run:
$ sudo stack -mysql -purge
"Site" command examples:
The site command is used to manage websites hosted in your webserver. Using this command, we can create HTML, PHP and wordpress sites.
View the list of hosted sites in your server:
$ sudo site -list
- 22222 - example.com - html
Create a basic HTML site:
$ sudo site domain.com -html
Create a site with PHP support:
$ sudo site domain.com -php
Create a wordpress site:
$ sudo site domain.com -wp
Create wordpress multisite, either in subdomain or subdirectory:
$ sudo site domain.com -wpsubdom
$ sudo site domain.com -wpsubdir
Enable/Disable FastCGI cache:
$ sudo site domain.com -cache
$ sudo site domain.com -nocache
Enable cache while creating a site:
$ sudo site domain.com -wp -cache
Enable/Disable SSL certificate:
$ sudo site domain.com -ssl-on
$ sudo site domain.com -ssl-off
$ sudo site domain.com -on
$ sudo site domain.com -off
Remove a specific site:
$ sudo site domain.com -delete
Remove all sites hosted in the webserver:
$ sudo site -delete-all
“HttpAuth” command examples:
The HttpAuth command is used to manage the users with permission to access pages protected by the HTTP authentication method.
To create a user to access pages protected with HTTP Authentication, run:
$ sudo httpauth -add
Delete the user:
$ sudo httpauth -delete
Enable/Disable HTTP authentication in wordpress login:
$ sudo httpauth -wp-admin-on
$ sudo httpauth -wp-admin-off
List all users with HTTP authentication:
$ sudo httpauth -list
The above command will create a wordpress site with FastCGI cache enabled.
Have you ever tried Webinoly in production? How'd it go? Share your thoughts about this script in the comment section below.