2019-05-01_Linux_Format

(singke) #1

http://www.techradar.com/pro/linux May 2019 LXF249 75


WordPress to static HTML TuTorials


net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
One done, use the command sudo sysctl -p to make
the changes permanent. Doing so can, however, impact
applications such as apt. To mitigate the issue, force
the apt tools to use IPv4. Do this by editing the
appropriate file /etc/apt/apt.conf.d/99force-ipv4:
sudo vi /etc/apt/apt.conf.d/99force-ipv4
Acquire::ForceIPv4 “true”;
We recommend a reboot to ensure everything is
correctly configured. All being well, at this point all the
configuration is completed and updating your site has
become as simple as performing the export as covered
in the previous article, then exporting the Zip file and
uploading it to the production system as we’ve
discussed above.
If you haven’t done so already, run the Simply Static
export and download the zipped content file. Once
downloaded, it can be uploaded directly to the
webserver using the scp command. To copy the file to
the webserver, use the following command, substituting
as required:
scp my_export.zip adminuser@livinginstarbucks.
com:/home/adminuser -p 999
Once uploaded, create a folder (called out in our
example) and unzip the file:
unzip my_export.zip -d out/
At this point there should be a folder with the
contents of the WordPress export. Copy the files into
the /home folder, correcting the path as needed. Note
that any WordPress links will have been converted to
folders and HTML text, so it is vitally important you
make sure all files are copied:
sudo cp -r /home/adminuser/my_export/out* /var/
www/www.livinginstarbucks.com/html/
Depending on the configuration the owner and rights
may need to be reset. This was done earlier and can
just be repeated. At this point, open a new web browser
and open the website. All being well, you should see the
static version of the website.
For those that are a bit more technically advanced,
it’s quite a simple affair to subject all these revisions to
version control so that you can effectively see every


revision to date. The easiest way to do this is to create
a Git-based repository in the cloud – choose from any
of the major providers. Unless you have reason not to,
make it a private repository.
Create your changes and perform the export from
Simply Static. Once downloaded, uncompress the files
and copy them into the Git-controlled folder. Add them
as a new revision, commit and push it up.
On the server side, install the git client:
sudo apt-get install git -y
At this point it becomes a simple affair to then log in
to the webserver and clone the files to the webserver’s
/html folder.
There are tweaks and options for other setups, but
hopefully these tutorials provides a glimpse of what is
possible when creating a static WordPress site.

getMorerAWhtML Subscribe now at http://bit.ly/LinuxFormat


The live pure
HTML website.

Whenusing
publicand
privatekey
logins,it’s
essentialto
ensureyouhave
a copyofat
leasttheprivate
key.Withoutit,
logginginwon’t
workbecause
wedisabled
password-
basedlogin.

understAnding Mod_reWrite


Without this function working correctly, the whole export process will
fail. Mod-Rewrite is used to rewrite URLs on the fly. Signs of it failing
to work may be seen if the administrator clicks on a link and they get
the well-known ‘404 page not found’ error. The entire permalink
setup relies on mod_rewrite working correctly. If mod_rewrite fails, so
will the export of the WordPress posts and therefore the final set of
web pages will not work correctly.
Mod_rewrite is very configurable and provides great functionality.
One example is to enable URLs to be rewritten to send data to a PHP
script that can use the input as part of the data to process, and the
script then outputting the PHP. Also, mass migrations can use mod_
rewrite to deal with merging several domains’ worth of data into a
single instance, using mod_rewrite depending on the entry URL used.
A more detailed breakdown and discussion of mod_rewrite can be
found at the Apache.org website (http://bit.ly/lxf249mod).
Depending on the configuration, mod_rewrite can be specified in
several places as needed, even down to the individual HTML folder.
The /etc/apache2/httpd.conf file is the master file that sets the
baseline settings that all virtualhosts takes as its base settings.
If the feature is not enabled in the root of our config, none of the web
hosts will work. Before changing any of these files, be sure to make a
backup so that any changes that are made can be easily reversed.
Free download pdf