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 -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 sudo site example.com -clone-from=staging.example.com sudo site example.com -redirection
How can I create a new site?
To create a basic HTML site, use the following command:
sudo site example.com -html
To create a site with PHP support.
sudo site example.com -php
All sites using the primary/main domain (not a subdomain) are configured to respond to requests from
www.example.com (See the force-redirect option).
To create a PHP site in conjunction with a database:
sudo site example.com -mysql
The data to connect to the database will be displayed after executing the command.
You can also use the “custom” option to introduce your own data before generating the database
sudo site example.com -mysql=custom 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 # Custom data sudo site -mysql=custom # Custom data sudo site -mysql=[host,dbname,dbuser,password] sudo site -mysql=[host,dbname,dbuser,password,external_dbuser,external_dbpass] # TIP Use "random" (without quotes) as password to automatically generate a random password.
Installing WordPress has never been so easy, Webinoly automatically configures the entire installation of WordPress.
sudo site example.com -wp
Use the “custom” option to modify some aspects of the database, in any way you can simply press <Enter> in each question to use the suggested data.
# Installation script of a WordPress site using the "custom" configuration sudo site example.com -wp=custom -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_] # TIP Use "random" (without quotes) as password to automatically generate a random password.
Webinoly supports the use of external databases for your WordPress site, for example Amazon RDS. It is very simple to configure, during the “custom” 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
* It is important to consider that the url should not contain the schema (http/https) at the beginning, in addition Webinoly does not support the use of “sockets” to connect to the external database and it should be taken into account that a poor design or implementation in the architecture of this kind of solutions can have a negative impact on the speed of your site, high latency or even multiple connection errors and timeouts.
** It has been successfully tested with Amazon RDS using MySQL, MariaDB and Amazon Aurora as the database engine.
Install WordPress in a subdirectory
You can have more than one WordPress installations under the same domain.
sudo site example.com -wp -subfolder=/test
You should always specify the
-subfolder argument to refer to this site and thus differentiate it from a common installation at the root of the domain.
sudo site example.com -delete -subfolder=/test sudo site example.com -cache=on -subfolder=/test sudo site example.com -yoast-sitemap=on -subfolder=/test sudo site example.com -multisite-convert -subfolder=/test sudo site example.com -clone-from=dev.example.com -subfolder=/test sudo site example.com -replace-content -subfolder=/test sudo httpauth example.com -wp-admin=on -subfolder=/test sudo log example.com -wp=on -subfolder=/test
Converting your WordPress site to Multisite has never been so easy.
sudo site example.com -multisite-convert
It will ask and you should go to “Tools -> Network Setup” to select the type of installation (subdomain or subdirectory); Webinoly will do all the configuration automatically once you have selected the type of Multisite you want.
* If your site has been installed with
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 example.com -cache=on
To disable FastCgi:
sudo site example.com -cache=off
You can also activate it from the creation of your new site as follows:
sudo site example.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 example.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 example.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] sudo site example.com -proxy=[url.com:8080] sudo site example.com -proxy=[url.com]
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 example.com -on
sudo site example.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 example.com -delete
You can also use the “force” option to omit the questions (unattended)
sudo site example.com -delete=force.
# Tip - External Database (Unattended Script) # Do not erase Database sudo site example.com -delete=keep-db # Unattended delete with external DB sudo site example.com -delete=force -external-db=[user,pass] # Revoke SSL Cert sudo site example.com -delete=force -revoke=on
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 remanent stored data from your deleted sites.
# Extended example sudo site -delete-all=force -external-db=[user,pass] -revoke=on # Keep databases sudo site -delete-all=keep-db
When a site is deleted, if an external database is found, an attempt will be made to use the data from
-external-db , if they are not found, the user will be asked to enter the necessary data. The
-revoke=on parameter will remove and revoke the SSL Cert of a site if found, use the “off” option to keep the SSL cert.
List of your sites
To see a list of all your sites hosted on the server, use the following command:
sudo site -list
# TIP - Use the "raw" option to remove format and have a filtered (all, main, parked, disabled) view. sudo site -list -raw=parked
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.
Enable/disable this feature in a specific site:
sudo site example.com -
You can enable/disable this feature global
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 example.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.
Once activated the SSL certificate, Webinoly will automatically configure Nginx to redirect all the traffic from your site from HTTP to HTTPS.
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 example.com -ssl=off
# Use the "revoke=(on/off)" option to skip questions. (Unattended) sudo site example.com -ssl=off -revoke=on
-ssl=off option can be used even if your site doesn’t even exist anymore as a way to remove and revoke an orphan SSL cert.
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 example.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 example.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 WordPress Multisite installations in sub-domain configuration.
sudo site example.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.
To add a site to an existent Wildcard cert:
sudo site sub.example.com -ssl=on -add-to-wildcard=example.com
Only have support for first-level subdomains.
Although Webinoly has a redundant system for the automatic renewal process, we have an option to force it.
sudo site -ssl=renew
This command attempts to renew any previously-obtained certificates that expire in less than 30 days.
We can also force the renewal of a specific certificate:
sudo site example.com -ssl=force-renewal
In the case of parked domains or “reverse proxy” sites, the parameter
-root-path respectively necessary to force the renewal must be included.
Staging environment for certs
We highly recommend testing your projects using the Let’s Encrypt staging environment before using real certs in production environment. This will allow you to get things right before issuing trusted certificates and reduce the chance of your running up against rate limits.
sudo webinoly -conf-value_debug=true
Use the “debug” variable in the Webinoly configuration file to activate the Let’s Encrypt test environment. You should never use these certificates in a real or production environment, set it to “false” to deactivate the testing environment.
Custom SSL Certificate
Bring your own Cert!
You can add your own cert of any third-party vendor or your preference.
sudo site example.com -ssl=on -ssl-key=/path/cert.key -ssl-crt=/path/cert.crt -ssl-ocsp=/path/cert.pem
-ssl-ocsp parameter is optional for OCSP support.
You can clone any WordPress site.
This feature is also known as “staging sites” due to its usefulness during the development stage.
sudo site example.com -clone-from=dev.example.com
Every link in your content will be updated automatically, you can disable this option as follows:
sudo site example.com -clone-from=dev.example.com -replace-content=off
The replace-content option can be used alone in any other WordPress site to search and replace any word or string in your content.
sudo site example.com -replace-content
# To skip questions sudo site example.com -replace-content=[search-this,replace-with]
* Only localhost sites supported, external-database support will be added soon.
Creating a redirection is easy, just run this command and follow the instructions:
sudo site example.com -redirection
Remove a redirection:
sudo site example.com -redirection -delete
# Skip questions (unattended) sudo site example.com -redirection -from=/path -to=/test -http-code=308 sudo site example.com -redirection -from=/path -to=http://example.com sudo site example.com -redirection -from=/path -http-code=410 sudo site example.com -redirection -delete -from=/path
You can also use the
-exact option to define an exact match of URI and location.
What the "EXACT" option does? Take this path: /news https://example.com/news (match) https://example.com/news/local/our-city (match) If you use the "EXACT" option: https://example.com/news (match) https://example.com/news/local/our-city (no-match)
List current redirections:
sudo site example.com -redirection -list
-list -raw option is supported to remove format characters.
NGINX Setup per site
If need to add additional NGINX rules, you can have your own custom configuration file located at
/var/www/example.com and it should be named following the pattern
*-nginx.conf, for example:
custom-nginx.conf would be a valid filename.
In the same way for “Reverse Proxy” sites you can have your own custom configuration NGINX file located at
/var/www/.proxy/*-example.com.nginx.conf, por example:
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.
If you have any suggestions, ideas, or comments, or if you (gasp!) found a bug, join us in the support forum.