Koozali.org formerly Contribs.org

Wordpress as Default SME Site

Offline Bud

  • ****
  • 487
Wordpress as Default SME Site
« on: August 23, 2018, 06:26:16 AM »
guys please can you assist me

i am trying to use wordpress being the default SME 9.2 Site

so if i type in http://localhost or http://mysmeserverip it must load a wordpress template

i have read https://wiki.contribs.org/Wordpress including https://wiki.contribs.org/Wordpress_Multisite but do not want to load the site as http://localhost/wordpress or http://mysmeserverip/wordpress

how do i do it?

any help greatly appreciated  :-)

Re: Wordpress as Default SME Site
« Reply #1 on: August 23, 2018, 01:42:06 PM »
Hi Bud,

I made some documentation on WordPress & SME. They are in French but you can easily follow the commands and there is a lot of images.

For the installation in an i-bay: https://www.micronator.org/affaires/produit/micronator-101-cahier-5sme-wordpress-et-wordfence/.

For all of the documents: https://www.micronator.org/affaires/produit/micronator-101-cahier-5sme-wordpress-et-wordfence/.

All documentation is free but registration is required.

Michel-André

Offline mmccarn

  • *
  • 2,428
Re: Wordpress as Default SME Site
« Reply #2 on: August 23, 2018, 03:00:21 PM »
I just installed it on my SME9.2 server using these steps:
Code: [Select]
# Wordpress 4.9.8 (current version as of 8/23/2018)
# 'requires' php72 and mysql56
#
# smeserver-php-scl doesn't support php72 (yet)
#
# Installed using php71 / php57

# * Install smeserver-php-scl
# https://wiki.contribs.org/PHP_Software_Collections

# Install smeserver-mysql57
# https://wiki.contribs.org/Software_Collections:MySQL57
yum install --enablerepo=smecontribs smeserver-mysql57
signal-event post-upgrade; signal-event reboot

# create ibay
IBAY=wordpress
/sbin/e-smith/db accounts set $IBAY ibay FollowSymLinks enabled CgiBin enabled AllowOverride All Group www PublicAccess global UserAccess wr-group-rd-everyone PhpVersion php71
/sbin/e-smith/signal-event ibay-create wordpress

# set WP config values in accounts db for reference
db accounts setprop wordpress DB_HOST 'localhost:/var/lib/mysql/mysql57.sock' DB_USER wp-user DB_PASSWORD $(< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-32};echo;) DB_NAME wordpress

# download latest wordpress
IBAY=wordpress
cd /home/e-smith/files/ibays/$IBAY/files/
wget https://wordpress.org/latest.tar.gz
tar xzf latest*
mv ../html ../html-old
mv wordpress ../html

# correct ownership and access rights on ../html
signal-event ibay-modify wordpress

# Create database
MYSQL='/opt/rh/rh-mysql57/root/usr/bin/mysql  --socket=/var/lib/mysql/mysql57.sock'
IBAY=wordpress
DBNAME=$(db accounts getprop $IBAY DB_NAME)
DBUSER=$(db accounts getprop $IBAY DB_USER)
DBPASS=$(db accounts getprop $IBAY DB_PASSWORD)

$MYSQL -e "drop database IF EXISTS $DBNAME"
$MYSQL -e "create database $DBNAME COLLATE=utf8_general_ci"
$MYSQL -e "grant all privileges on ${DBNAME}.* to '${DBUSER}'@'localhost' identified by '$DBPASS' with grant option"

#
# insert config settings into wp-config.php
IBAY=wordpress
cd /home/e-smith/files/ibays/$IBAY/html
cp wp-config-sample.php wp-config.php
DBHOST=$(db accounts getprop $IBAY DB_HOST)
#
sed -i s/database_name_here/${DBNAME}/ wp-config.php
sed -i s/password_here/${DBPASS}/ wp-config.php
sed -i s/username_here/${DBUSER}/ wp-config.php
sed -i s~localhost~${DBHOST}~ wp-config.php
# ( ${DBHOST} contains slashes, so use a different delimiter for sed)

# point the primary ibay at the new ibay
IBAY=wordpress
DOMAIN=$(config get DomainName)
db domains setprop ${DOMAIN} Content ${IBAY}
signal-event remoteaccess-update


Now browse to your Primary ibay and you should get the wordpress install screen asking you to create an admin user and password.

[edit]
Allow plugin installation and wordpress updates:
Code: [Select]
IBAY=wordpress
echo -e "\n/** Allow Upgrades */\ndefine('FS_METHOD', 'direct');" >> /home/e-smith/files/ibays/$IBAY/html/wp-config.php

Restore Primary ibay content:
Code: [Select]
DOMAIN=$(config get DomainName)
db domains setprop ${DOMAIN} Content Primary
signal-event remoteaccess-update
« Last Edit: August 24, 2018, 04:03:40 PM by mmccarn »

Offline Bud

  • ****
  • 487
Re: Wordpress as Default SME Site
« Reply #3 on: August 24, 2018, 06:41:42 AM »
michelandre and mmccarn

thank you very much for your help, much appreciated

Offline Bud

  • ****
  • 487
Re: Wordpress as Default SME Site
« Reply #4 on: August 29, 2018, 11:58:59 AM »
mmccarn thank you for the update

i do have a question about remote access to the "wordpress" website

i am using dyndns

i have issued the following commands:
# config setprop wordpress PublicAccess global
# signal-event wordpress-update ( i get an error - Can't open directory /etc/e-smith/events/wordpress-update )
# signal-event console-save ( no problems with this command )

however when i try to login remotely ie: " https://mydyndns/ " it does not load the website ( it automatically goes to https )
i can login on the lan side ie: " http://sme "
when i look at the wordpress " Settings > Generals > WordPress Address (URL) = http://sme
when i look at the wordpress " Settings > Generals > Site Address (URL) = http://sme

any ideas what i need to do to be able to get lan and wan access to the sme wordpress site?

any help greatly appreciated  :-)

Offline mmccarn

  • *
  • 2,428
Re: Wordpress as Default SME Site
« Reply #5 on: August 29, 2018, 01:24:15 PM »
The commands I provided install wordpress without any supporting SME scripts or other commands -- so there won't be any "event" with wordpress in the name of the event (no "signal-event wordpress-update").

To update firewall and httpd configurations after making changes use
Code: [Select]
signal-event remoteaccess-update

Unless you've done something you haven't mentioned yet, there shouldn't be anything in the "config" database for wordpress -- everything we did was in the "accounts" and "domains" databases. The commands I gave for creating the ibay had public access enabled:
Quote
# create ibay
IBAY=wordpress
/sbin/e-smith/db accounts set $IBAY ibay FollowSymLinks enabled CgiBin enabled AllowOverride All Group www PublicAccess global UserAccess wr-group-rd-everyone PhpVersion php71
/sbin/e-smith/signal-event ibay-create wordpress

The "config" setting that would affect public access to your new ibay (to the server in general) is for the "httpd-e-smith" service.  Make sure that "httpd-e-smith" has "access=public":
Code: [Select]
# config show httpd-e-smith
httpd-e-smith=service
    SSLv2=disabled
    SSLv3=disabled
    TCPPort=80
    access=public
    status=enabled

Is your dyndns domain name the same as your primary domain name?  The commands provided configure Apache to serve wordpress using the primary domain name -- if you really need it to appear at a different domain you need to create that new domain and tell the server to use the wordpress ibay for content.

You can get the default domain using
Code: [Select]
config get DomainName
Finally, the first time you browse to wordpress and let it run its install script, it sets database values based on the URL you used -- if you didn't use the same *public*  address during setup, you'll need to correct them before wordpress will work. Wordpress itself (nothing specific to SME) redirects visitors to the specified address before serving any content.

To check and change the wordpress address, login to wordpress "wp-admin", navigate to "Settings" and make sure the "Wordpress Address" and "Site URL" use the correct, public address (you need to be able to access your wordpress using the same URL from both inside and outside your network). 
* If they are NOT correct, change them BOTH to the correct value. 
* If the correct value only works publicly, you will lose local access to the site
* If things get messed up, you can set these values manually in wp-config.php as described here: https://codex.wordpress.org/Changing_The_Site_URL

While testing this for you I changed only the "Site Address (URL)" to my LAN IP address to see what would happen.  This prevented me from logging in.  I set both values in wp-config.php, logged in and found the two fields greyed out in wp-admin - removed the lines from wp-config.php, refreshed the page, and was able to reset them to the correct value...


« Last Edit: August 29, 2018, 01:26:36 PM by mmccarn »