The “Site” command allows us to manage the websites hosted on the server. Create any type of site on your new server, add an SSL certificate, activate FastCgi Cache for your WordPress installation and more features that will allow you to have total control over your sites easily and reliably, always at a command away and with no complications.
sudo site <domain> <option> <option2>
sudo site example.com -html sudo site example.com -wp=default -cache=on sudo site example.com -cache=off sudo site example.com -parked=domain.com sudo site example.com -proxy=[localhost:8082] sudo site example.com -off sudo site example.com -ssl=on sudo site example.com -ssl=on -root=domain.com sudo site -list sudo site -delete-all
How can I create a new site?
To create a basic HTML site, use the following command:
sudo site domain.com -html
To create a site with PHP support.
sudo site domain.com -php
If you need to create a Database to use with your new site:
sudo site domain.com -mysql
You can also use the “default” option to automatically generate the database
sudo site domain.com -mysql=default or in the same way you can pass the data directly.
# TIP Hack # Use the -mysql option without domain to create a DB and User (MySQL) sudo site -mysql # Default data sudo site -mysql=default # Custom data sudo site -mysql=[host,dbname,dbuser,password,external_dbuser,external_dbpass]
Installing WordPress has never been so simple, Webinoly automatically configures the entire installation of WordPress.
sudo site domain.com -wp
During the installation Webinoly will ask you if you want to modify some aspects of the database, in any way you can simply press <Enter> in each question to use the suggested data. You can also omit the questions using the default configuration as shown below:
# Installation script of a WordPress site using the "default" configuration sudo site example.com -wp=default -cache=on # WordPress Multisite with "default" configuration sudo site example.com -wpsubdir=default -cache=on
In the same way you can do the installation using custom data:
sudo site example.com -wp=[<setup_db>,<setup_wp>,<host>,<dbname>,<dbuser>,<dbpass>,<wp_prefix>,<external_db_user>,<external_db_pass>]
# WordPress installation script with custom data. sudo site example.com -wp=[true,true,localhost,example_com,example_user,password,wp_]
Choose the type of installation you require, either in subdomain or subdirectory, use the appropriate command for each option.
sudo site domain.com -wpsubdom
sudo site domain.com -wpsubdir
Once you have entered in your new site, as is common, WordPress will ask you to select the language, user, mail, among other options. Since you are logged in WordPress will ask or you should go to “Tools -> Network Setup” to select the type of installation, subdomain or subdirectory again and will ask you to make some changes to your
wp-config.php file; Webinoly has already added these lines, you only have to access the file and remove the comments manually for them to take effect.
Webinoly supports the use of external databases for your WordPress site, for example Amazon RDS. It is very simple to configure, during the installation of your site you will be asked for the “dbhost”, by default it is configured as localhost, but in case of requiring the use of an external database you only have to add the path in the format url.com:port.
It has been successfully tested with Amazon RDS using MySQL, MariaDB and Amazon Aurora as the database engine.
Together with Nginx this is the best optimization you can do to speed up your WordPress site. Forget about using obsolete plugins like W3 Total Cache or Super Cache. FastCgi has demonstrated a performance far superior to the time to serve content cached from your server.
To enable FastCgi:
sudo site domain.com -cache=on
To disable FastCgi:
sudo site domain.com -cache=off
You can also activate it from the creation of your new site as follows:
sudo site domain.com -wp -cache=on
It is highly recommended to use the Nginx Helper plugin to dynamically renew and purge cached content automatically; in this way we ensure to always display the most updated content when necessary.
It is important to configure the Purge Method of the plugin as “Delete local server cache file”, the support for the purge/url method has been disabled because it is considered a security risk. Similarly, the “Caching Method” should be set to “Nginx FastCgi Cache”.
Parked domain or alias
A parked domain is an additional or alternate domain that points to a main site. It is a simple way to access your site from different domain names.
sudo site domain.com -parked
When executing the command you will be asked to enter the name of the main domain where the new parked domain will point to. In the same way you can use the command as follows to facilitate its use:
sudo site domain.com -parked=mainsite.com
Make sure the main site is hosted on the same server.
Reverse Proxy site
To create a site with Reverse Proxy configuration in Nginx:
sudo site example.com -proxy=[localhost:8080]
Replace the host and port values according to your needs.
How can I temporarily disable a site?
At any time you can activate or deactivate a site hosted on your server without deleting it.
sudo site domain.com -on
sudo site domain.com -off
Delete a website
You should use this option with caution, as once a site is deleted it will not be possible to recover the files.
sudo site domain.com -delete
You can also use the “force” option to omit the questions (Unattended script)
sudo site domain.com -delete=force.
# Tip - External Database (Unattended Script) # Do not erase Database sudo site domain.com -delete=[external,false] # Unattended delete with Custom Data sudo site domain.com -delete=[external,true,external_dbuser,external_pass]
To remove all sites hosted on your server:
sudo site -delete-all
The databases of your WordPress sites that are currently in use will also be deleted. Some other DB’s may not be deleted, so there may be remnant stored data from your deleted sites.
List of your sites
To see a list of all your sites hosted on the server, use the following command:
sudo site -list
Force WWW or non-WWW in a site
By default, Webinoly configures your site to accept both requests in your domain, that is,
www.example.com will be both valid. You can force the use and redirect the requests to any of your preferences.
sudo site example.com -force-redirect=<options>
In some special cases where an SSL certificate has been imported from another provider and this does not include the “www” domain or vice versa, we can use the
-ignore-ssl option as follows:
sudo site example.com -force-redirect=root -ignore-ssl.
SSL Certificates with Let’s Encrypt
We take advantage of the facilities provided by Let’s Encrypt to generate free certificates for your site and make it even easier to configure your site easily and quickly.
There is no pretext for not migrating your site to HTTPS, just by executing the following command your new website will be fully configured to navigate securely over HTTPS.
sudo site domain.com -ssl=on
During the creation of the certificate, Webinoly will ask for your email account, this email will be used to register the new certificate, in addition to helping you to follow up the periodic renewal process.
The certificates issued by Let’s Encrypt are valid for a period of 90 days and before that period it is recommended to request the renewal to keep it up to date. Webinoly automatically checks once a week the status of the certificates of all your sites and those that have less than 30 days of validity period is automatically requested for its renewal. Therefore, you should not worry, since Webinoly automatically completes the process to keep your certificates and your sites always in force.
During each weekly renewal check you will receive an email in the account that you have registered with the current status of each certificate.
Disable SSL on a site
If for some reason you need to deactivate the use of the SSL certificate in your site, just execute the following command.
sudo site domain.com -ssl=off
# Use the "force" option to skip questions. (Unattended) sudo site domain.com -ssl=off-force
Certificates in parked sites
The “-root” option allows you to create certificates for sites where the root of your files is in a different place than usual; this is the case of parked sites, since the parked domain does not even have a root directory or own files, however, it points to another site hosted on the same server.
sudo site domain.com -ssl=on -root=mainsite.com
A common and practical example of the above case is in WordPress Multisite installations with Domain Mapping, where you have one or more parked (mapped) domains on your server pointing to a main site.
Certificates on Reverse Proxy sites
The “-root-path” option allows us to specify a different route, as is the case of sites in Reverse Proxy configuration where the files are stored in a location different than
sudo site domain.com -ssl=on -root-path=/opt/myapp/web
When we need a single certificate to cover all subdomains (* .example.com). This is the kind of certificate we need in WordPres Multisite installations in sub-domain configuration.
sudo site domain.com -ssl=on -wildcard
During the creation of the Wildcard certificate it will be necessary to create a DNS record to verify the ownership of the domain.
NGINX Setup per site
If need to add additional NGINX rules, you can have your own custom configuration file located at
/var/www/domain.com and it should be named following the pattern
*-nginx.conf, for example:
custom-nginx.conf would be a valid filename.
Webinoly automatically detects if your site is a domain
example.com or subdomain
sub.example.com, this is to determine the most appropriate Nginx configuration for each site. It is a Let’s Encrypt requirement and a standard that each domain must allow access automatically to its version with “www”, if your site is hosted in a subdomain this is not necessary.
If for some reason you need to force a certain configuration, you can do it using the
-subdomain option when creating your site. Example:
sudo site example.com -html -subdomain=true, or likewise
sudo site sub.example.com -html -subdomain=false.
With the command
sudo webinoly -external-sources-update you can update the “Public Suffix” list that we use to determine if a site is a subdomain or not and the timezones database.
Any doubts about the use of Webinoly do not hesitate to consult or ask through the support forum.